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

samdanavia / ambitious_query_indexer

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

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • 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.

Pain-free indexing to speed up your Rails app — Read more

  cancel

http://www.samsworldofno.com/2009/10/05/introducing-ambitious-query-indexer/

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

This URL has Read+Write access

Slight tidying to a method that remains too messy 
samdanavia (author)
Sat Oct 10 13:29:03 -0700 2009
commit  c397c4e72660711c23b66f34bd09d24d8eabdc22
tree    07767c279bda1684f15af220f225765df6270631
parent  935c389a0b23a0bbcc0678cb99fc2c7669d7326a
ambitious_query_indexer /
name age
history
message
file MIT-LICENSE Loading commit data...
file README.textile
file Rakefile
file install.rb
directory lib/
directory tasks/
directory test/
README.textile

Ambitious Query Indexer

Ambitious Query Indexer is a Rails plugin to identify database indexes that are missing. Rather than looking at tables and guessing what needs indexing, it will locate and run as many queries as it can find and suggest indexes that could be added based upon its findings.

This plugin is still in beta; at the moment there are various queries that it doesn’t understand and it could be better at finding methods in your application that run queries. That said, even now its recommendations should help your database load considerably.

I’m really eager for feedback on this plugin. If you have any thoughts or ideas, please let me know.

Installation

script/plugin install git://github.com/samdanavia/ambitious_query_indexer.git

Dependencies

This plugin uses the ‘multi’ gem. Install with:

sudo gem install multi

Usage

In the root of your Rails app, run the following:

rake ambitious_query_indexer:analyze

This plugin runs queries on your test database. Ensure that it is up-to-date (‘rake db:migrate RAILS_ENV=test’) and representative of your live schema for best results.

Testing

Run the following from the root of your Rails app:

rake test:plugins PLUGIN=ambitious_query_indexer

NB: This plugin’s tests create tables in your test database. Any tables created will be prefixed with ‘aqi_test’. In the unlikely event that you have a table that follows this same convention, you may see it trashed in the test environment.

Upcoming features/enhancements

General

  • Auto-generation of migrations
  • Highlighting redundant indexes
  • Ability to pass individual finders or sql queries for index recommendations
  • Support for common conventions in specific plugins – eg ‘current_user’ for RestfulAuthentication
  • Support for ambitious_model_loader and similar plugins
  • Statistics output – similar to rake stats
  • Support for databases other than MySQL
  • Other optimisation advice – common query smells etc

SQL Optimisation

Enhancements to the SQL optimisation engine:

  • Support for lazier queries – implicit joins and implicit table references (‘field’ rather than ‘table.field’)
  • Stronger support for conditionals – including FUNCTION() calls and references to other tables
  • Support for difficult-to-index operators such as LIKE and RLIKE
  • Support for HAVING
  • Support for JOIN ON
  • Support for aliased tables (AS)

Object Call location

Enhancements to the code that deals with finding the methods that run queries:

  • Better support for associations and named_scopes and other methods which run queries
  • Support for commented-out lines

Feedback

All feedback, bug reports and thoughts on this gratefully received.

Copyright © 2009 Sam Phillips, released under the MIT license

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