March 21st, 2012, 02:27 PM
\timing in PL/pgSQL language in SQL file
Hi, I know how timing work in postgresql prompt, how I do is to type \timing.
However, I have created a sql file that is based on PL/pgSQL language, for example, the sql file looks like the following,
CREATE OR REPLACE FUNCTION make_plpgsql()
CREATE LANGUAGE plpgsql;
for loop on some tables
\timing <----------------------- gives me error
for loop on some tables...
The error is like the following,
psql:test.sql:78: ERROR: syntax error at or near "\"
LINE 39: \timing
How do I make timing work in PL/pgSQL language in SQL file? Thank you.
March 21st, 2012, 02:47 PM
You can't \timing is a psql (only) command and does not work inside a function.
Originally Posted by Kalimoor
You need to do the timing when using the function in psql, basically something like this:
Timing is on
Time: xx ms