Postgres: To get duration of a script

(1) Enable the extension (if not already enabled):

CREATE EXTENSION pg_stat_statements;



(2) Check the execution time:

SELECT query, total_time, calls 

FROM pg_stat_statements

WHERE query LIKE '%your_query%';


OR


SELECT query, total_time, calls FROM pg_stat_statements WHERE query LIKE '%your_query%';



total_exec_time double precision

Total time spent executing the statement, in milliseconds


Comments

Popular posts from this blog

Oracle: To clean up WRI$_ADV_OBJECTS