Skip to content

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

License

Notifications You must be signed in to change notification settings

eladmeidar/rails_indexes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

This gem doesn’t really work on Rails 4 – no plans on upgrading it anyway. you probably should take a look at lol_dba

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 may be more fields depending on your application design and custom queries.

Rails 3.x and 4.x

If you’re using Rails 3.x or 4.x, you probably should take a look at lol_dba

Installation

as a rails plugin:

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

Usage

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

rake db:index_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:find_query_indexes

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

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages