Jump to content

[SOLVED] Count how many queries are made to mysql


papaface

Recommended Posts

Short of adding the code manually next to each MySQL query I'm not sure how you would do it the way you're wanting to. An alternative could be, if you're using MySQL >= 5.0.2, is to create a stored routine / trigger that increments a table field on every query that takes place.

 

This would be causing a lot of unnecessary load on your server using either method - Are you sure you need to do this?

I just want a way of comparing an unoptimized script that was heavy on mysql with a lot of queries, with a script I have optimized.

I want a way of showing the guy I am doing this for how much I've managed to cut down the queries to the db.

Could you not store a timestamp at the beginning of the script, then again at the end of the script, subtract one from the other and convert to seconds? This will give you the script execution time, which I believe includes queries - A fair comparison for your optimisation demonstration...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.