0

Can i get query actual execution time (of all query) in query result PostgreSQL? Like this:

select __get_execution_time() some_column 

return:

 some_column
 -----------
 1 sec

Is it possible to imlement such a function? I want to get result and execution time in one query.

1 Answer 1

2

There is no such function in PostgreSQL.

What you can do is run

EXPLAIN (ANALYZE, FORMAT 'json') SELECT ...

and get the "Planning Time" and "Execution Time" properties from the result.

Sign up to request clarification or add additional context in comments.

3 Comments

Is it possible to imlement such a function? I want to get result and execution time in one query.
Yes, that is certainly possible.
I don't know how to do this. How to give all of query into function args? Can you help me?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.