When a page is slow I want to see which query takes the time, and which function asked for it.
define( 'SAVEQUERIES', true );
// in a template, for admins only:
global $wpdb; if ( current_user_can( 'manage_options' ) ) { var_dump( $wpdb->queries ); }
With SAVEQUERIES on, $wpdb->queries becomes an array of entries, each with the SQL text, the time it took and the functions that called it. Sort by time to find the slow one. It adds overhead to every request and keeps all queries in memory, so use it on a staging copy or only for a short test, and never output the array to visitors. A plugin like Query Monitor shows the same information in a nicer way.
Further reading: WordPress: Debugging in WordPress