Is there any way to see current mysql query and its response time in browser? I am working on simple php not on any framework. Anybody know any addons for FF which gives me this information.
Please help
thanks
I use the profiling function of MySQL server (from 5.0.37).
<?php
// profiling init
$set_profiling = $mysqli->query( 'SET profiling = 1' );
// some stuff
$result1 = $mysqli->query( 'SELECT DESTINATIONCODE, ZONENAME FROM ZONES' );
$result2 = $mysqli->query( 'SELECT ZONENAME FROM ZONES' );
// showing profiling printout
$show_profiles = $mysqli->query( 'SHOW PROFILES' );
while( $row = $show_profiles->fetch_assoc() ) {
echo '<pre>';
print_r( $row );
echo '</pre>'
}
In addition, if you want a more detailed report after each query you can use:
$show_profile = $mysqli->query( 'SHOW PROFILE' );
Check http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html .
That's a bit raw visualization but it works.
Example output:
Array
(
[Query_ID] => 1
[Duration] => 0.00012000
[Query] => SELECT DESTINATIONCODE, ZONENAME FROM ZONES
)
Array
(
[Query_ID] => 2
[Duration] => 0.00006800
[Query] => SELECT ZONENAME FROM ZONES
)
And detail for #1 query:
Array
(
[Status] => (initialization)
[Duration] => 0.000002
)
Array
(
[Status] => checking query cache for query
[Duration] => 0.000003
)
Array
(
[Status] => checking privileges on cached
[Duration] => 0.000002
)
Array
(
[Status] => checking permissions
[Duration] => 0.000001
)
Array
(
[Status] => sending cached result to clien
[Duration] => 0.000056
)
Array
(
[Status] => logging slow query
[Duration] => 0.000001
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With