papaface Posted December 10, 2007 Share Posted December 10, 2007 Hello, Is it possible to increment a integer in a text file every time a query is made to mysql without changing much code? regards Quote Link to comment Share on other sites More sharing options...
zq29 Posted December 10, 2007 Share Posted December 10, 2007 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? Quote Link to comment Share on other sites More sharing options...
papaface Posted December 10, 2007 Author Share Posted December 10, 2007 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. Quote Link to comment Share on other sites More sharing options...
zq29 Posted December 10, 2007 Share Posted December 10, 2007 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... Quote Link to comment Share on other sites More sharing options...
papaface Posted December 10, 2007 Author Share Posted December 10, 2007 Thanks for that idea Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.