I have written a custom PostgreSQL client and I want to add a function that would automatically capture query execution time.
executionTime value in Slonik results records the total query execution time, including the roundtrip and parsing. In order to capture the actual query execution time, I plan to prefix every query with
EXPLAIN ANALYZE, parse the explanation and capture the results of the query. However, I cannot find a way to run EXPLAIN ANALYZE and capture the actual query result (in addition to explain output).
How to run EXPLAIN ANALYZE and get results of the query?