in reply to Basic Perl trumps DBI? Or my poor DB design?
As perrin said, learn how to use explain. Your database decides which index (access path) to use. The one access path seems to be the best to you, might not seem to be optimized to the database. Explain tells you exactly which access path the database actually uses.
Also I am not sure MySQL let you do analyze like Oracle does. In Oracle, once a while, you have to run an analyze, so that Oracle gathers the lastest statistics data about your database. Without the right statistics, database could easily choose the wrong access path. Sometime even decides not to use index at all.
|
|---|