How to properly debug and inspect SQL Queries in PHP File? My website AdminPanel has a PHP file which takes almost 30-40 seconds in loading.  I doubt the queries which are making the mess, but may be it is the code but the code structure seems perfect. I want to find and check the all the queries execution and running time i.e how much time it takes to execute? But i can't. 

I tried the slow query logs option but it is not logging anything. And from the general log i just see queries but no execution time and details.

Thanks
SET GLOBAL long_query_time = 1;
to log slow queries taking 1 second or more.

EXPLAIN EXTENDED SELECT ..... to see valuable information about how the query is getting to the result.

Follow immediately in the same session,
SHOW WARNINGS;
to see how the Optimizer rearranged the sequence of events.
(Rick James, thanks for the reminder.)