github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

eladmeidar / rails_indexes

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 242
    • 9
  • Source
  • Commits
  • Network (9)
  • Issues (3)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • master ✓
    • tests
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A rake task to track down missing database indexes. does not assume that all foreign keys end with the convention of _id. — Read more

  cancel

http://blog.eizesus.com/2009/9/find-where-to-index-your-tables-on-a-rails-app/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Fixed deprecation notice, RailsIndexes is now Rails3 compliant. wut wut 
eladmeidar (author)
Sat Jan 16 22:11:10 -0800 2010
commit  1dcd9e23b7b7c6740f33264e8235f6fd17eb6abb
tree    8e36042e468ea850dcbfbf050eab0597c893c104
parent  d09a13bf93468e4e71fa4e6877483c4af8afc5f1
rails_indexes /
name age
history
message
file MIT-LICENSE Sat Sep 12 16:15:21 -0700 2009 Missing plugin files [eladmeidar]
file README.textile Tue Nov 10 21:09:15 -0800 2009 readme updated with new tests. [eladmeidar]
file Rakefile Sat Sep 12 16:15:21 -0700 2009 Missing plugin files [eladmeidar]
directory lib/ Sat Jan 16 22:11:10 -0800 2010 Fixed deprecation notice, RailsIndexes is now R... [eladmeidar]
directory tasks/ Tue Sep 15 17:30:24 -0700 2009 Fixed the typo in the rake task on the deprecat... [eladmeidar]
directory test/ Sat Jan 16 22:11:10 -0800 2010 Fixed deprecation notice, RailsIndexes is now R... [eladmeidar]
README.textile

Rails Indexes

Rails indexes is a small package of 2 rake tasks that scan your application models and displays a list of columns that probably should be indexed.

note: there should be mode fields depending on your application design and custom queries.

Installation

as a rails plugin:

script/plugin install git://github.com/eladmeidar/rails_indexes.git

Usage

Display a simple report:

rake db:show_me_some_indexes

– deprecated

Display a migration for adding/removing all necessary indexes based on associations:

rake db:show_me_a_migration

Display a migration for adding/removing all necessary indexes based on AR::Base#find calls (including: find, find_by, find_all_by, find_by_x_and_y, find_all_by_x_and_y):

rake db:show_me_ar_find_indexes

Note that it would probably make more sense running those tasks on production, where you actually need those indexes to be added.

  • Add an option to create a migration that adds all the needed indexes.
  • Add an option to scan the application root tree for #find, #find_all_by and #find_by to get some more index-required columns.

Tests

Requires SQLite3 installed, then just:

rake

to run the tests

Author:

Elad Meidar
http://blog.eizesus.com

Thanks:
Eric Davis,
http://littlestreamsoftware.com

Released under the same license as Ruby. No Support. No Warranty, no Pain.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server