![]() |
Slow SQL Help | ![]() |
---|---|---|
Slow SQL queries can be one of the most frustrating and
performance degrading aspects of database administration. What
makes it particularly frustrating is if you have developers
on your production box. :-)
Bad queries manage to find their way into every database. Karma
provides a method to be a little more proactive about monitoring
this activity, and letting you know hopefully before they
become a problem. Karma, though, can only help identify those
queries that are problems, it can't optimize them.
Optimizing queries can mean anything from analyzing related tables
and indexes in a schema, providing hints to suggest a better
execution plan, creating indexes to provide Oracle with a faster
way to the data, or actually rearranging the query so that
perhaps it enables an index that it previously disabled.
For more information on all aspects of SQL query tuning
see Guy Harrison's book "Oracle SQL High Performance
Tuning" - ISBN 0136142311.
Here's a configuration example:
slowsql:15:100:200
In this example we're monitoring every 15 minutes. We're deciding
that queries that do more than 100 data block I/Os flags a
WARNING, and 200 I/Os flags an ALERT. Adjust this to suit the
needs of your particular database, and the speed of your disks.
On an RAID array for example, you might be able to multiply
these numbers by 5 and still see good performance.
Please test this before running it on your production database
and limit how often you run it, as it can be a "slow sql" query.
|