If you want to see how a query like \du is being built:
\set ECHO_HIDDEN
analysiscommandsconfigurationpostgresqlpsqlsql
Use explain:
EXPLAIN SELECT * FROM some_table WHERE condition;
analysisexplainperformancepostgresqlsql
If you want to see how long a query is taking to run, you can either run explain analyze or enable timing for the client by typing \timing.
analysisconfigurationdebuggingdurationoutputperformancepostgresqlpsqlruntimesqltiming