Lazy Indexing

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

2 comments

Comments 1 - 2 of 2 previous next Post a comment

Post a comment
Embed Video
Edit your comment Cancel

1 Favorite & 1 Group

Lazy Indexing - Presentation Transcript

  1. LAZY INDEXING matt aimonetti sdruby
  2. before we start I’m not a Database Administrator This talk only covers MySQL You will still need to understand indexing Dubbed version of this presentation will be available from Patrick ;)
  3. indexing SELECT * FROM users WHERE last_name = 'Aimonetti'; NO INDEX look at each row in the table, one at a time, to find all matching records (full table scan = SLOW)
  4. indexing SELECT * FROM users WHERE last_name = 'Aimonetti'; INDEX simply follows the b-tree data structure until the Aimonetti entries have been found = WAY FASTER
  5. indexing class User < ActiveRecord::Base has_many :team_members, :dependent => :destroy has_many :projects, :through => :team_members end current_user.projects SELECT `projects`.* FROM `projects` INNER JOIN team_members ON projects.id = team_members.project_id WHERE ((`team_members`.user_id = 1))
  6. indexing how to know what indexes to create?
  7. indexing N? HE W Every time you are using one of these associations in a model: belongs_to, has_many, has_one, or has_and_belongs_to_many association
  8. indexing N? HE W ✓ use a join in your query ✓query non-foreign-key column ✓ sort on a column or combination of columns
  9. T? indexing HA W EXPLAIN obtain information about how MySQL executes a SELECT statement
  10. indexing query-reviewer plugin http://code.google.com/p/query-reviewer/ by Kongregate and David Stevenson
  11. indexing add an index from your migrations: add_index :invoices, [:client_id, :invoiced_on] remove an index from your migrations: remove_index :invoices, [:client_id, :invoiced_on]
  12. indexing resources: http://code.google.com/p/query-reviewer/ http://weblog.jamisbuck.org/2006/10/23/indexing-for-db-performance http://www.mysqlperformanceblog.com/

Matt AimonettiMatt Aimonetti, 2 years ago

custom

1354 views, 1 favs, 0 embeds more stats

Easily optimize your Rails app by adding database i more

More Info

© All Rights Reserved

Go to text version
  • Total Views 1354
    • 1354 on SlideShare
    • 0 from embeds
  • Comments 2
  • Favorites 1
  • Downloads 43
Most viewed embeds

more

All embeds

less

Flagged as inappropriate Flag as inappropriate
Flag as innappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel

Categories

Groups / Events