Jump to content

Monitor database queries?


lark

Recommended Posts

Hi everyone,

I'm looking for a way to monitor queries to my databases. I'd like to optimize my code to minimize the load to my databases, but I currently have no way of telling when I'm making improvements. I'm on a managed server, so don't have root access to error logs etc.

Is there a simple way to do this? I considered making a function called query_count() for example, which would replace all of my mysql_query calls and track each query, but I hate to load the databases down with even more queries just to find out what the traffic is.

Any suggestions would be greatly appreciated.

Thanks!
Link to comment
Share on other sites

I would tell you to implement something in scripting, so you can time each query in a normal operating environment and store those results. Timing always gives you a good idea of how your database is doing in regards to a query. After you have these results you can use the query data to run these queries using the databases onboard diagnostic tools. Most all databases have query diagnostic tools which can explain a query. But remember this, no diagnostic tool can help you fix problems like using the wrong column types, over or under indexing, use of to many table relations and usages of a wrong function type! These are logic errors, if you have a lot of those and don't really understand how to fix them, then you should hire a consultant because any service running a database designed system needs to have that system structured properly!


me!
Link to comment
Share on other sites

I think for now I just want to monitor gross traffic in and out of the databases -- so purely just the number of queries... then focus on how efficient and time-consuming the queries are later.

Fenway, what's the best way to insert "timing breakpoints"

Thanks for your help!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.