At my job I have to maintain many different databases (most of them are MySQL, Postgres). Also with different shemas and applications running on them. Unfortunally many tables don't have enough indexes, some of the databases don't have indexes at all, which is really a bad situation at the moment and pumping the load up.
So I'am looking for a solution to autogenerate the indexes, I thought about the following ideas:
1) directly interact with the DBI (most of the applications are written in perl, lucky i'am) and analyze the queries for joins, where, orders and generate the index for the columns.
2) doing the same as in 1, but just log all the queries on the database level and parse the log file.
well, I'am not sure but I think this could be a problem which is maybe common: often the database and the application people are not the same and the applications get changed all the time. so, probably somebody allready came up with a more flexible solution?
Some of my wishes:
-database independant (or at least portable)
-priority for indexes (like how often the potential index could be used)
Thank you for your time you needed to read this post and specially for your replys.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.