|
![](/i/fill.gif) |
>> So one way takes almost three hours to do a single lookup, while the
>> other can do 40 lookups per second. O(log N) FTW!
>
> Which is why we really, really like indexes on database tables.
To quote Team America, "**** YEAH!"
Although - and not many people seem to understand this part - indexes
make looking up *one* element much faster (if you index the right
thing). However, if you're doing to end up needing to process a large
percentage of the table anyway, it's actually faster to *not use* any
indexes there might be.
This is why we have complex database engines with sophisticated
algorithms which attempt to pick the best method for performing each
query. Yet still it seems that certain people think that the task of
"tuning" an SQL query means working out which combination of optimiser
hints cause the database to always use indexes for that query. *sigh*
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |