Hey hubb0r,
One way of doing this is to use the EXPLAIN syntax. What it does is explain how MySQL would go about executing a query. The output will show you the keys thay the engine would use. You could run EXPLAIN on the set of queries that are most likely to be used on a regular basis and see if any indexes are not used. For more information, see MySQL EXPLAIN syntax.
Hope this helps,
davidj | [reply] |
Thanks davidj... I do understand the use of the explain syntax; I was thinking more along the lines of a switch or something that you turn on on the mysql server which would log which indexes are used... I envisioned running with this switch on for some period of time (say a week or two) and then examining the logs to see which indexes are always used, so I can know which aren't.
Most of the queries that are run against the server are dynamically generated, so it becomes difficult to pull them and do an explain on each... Especially since there are probably 50+ programs that access the database, each with 30 -50 different queries being run...
| [reply] |
| [reply] |
| [reply] |
hubb0r, for future reference, if you have any MySQL specific questions, you could do worse than to post them on the MySQL General Discussion mailing list instead of a Perl oriented forum.
| [reply] |
Vek,
You are right of course... it's just that I spend a lot of time on perlmonks and often enough questions come up regarding dbi or other db functionality, so I figured I might give it a shot.
Thanks all for your responses, even though my question was off topic. :)
| [reply] |