[PERFORM] How to profile an SQL script?

2008-12-03 Thread Kynn Jones
Hi.  I have a longish collection of SQL statements stored in a file that I
run periodically via cron.  Running this script takes a bit too long, even
for a cron job, and I would like to streamline it.
Is there a way to tell Postgres to print out, after each SQL statement is
executed, how long it took to execute?

Thanks!

Kynn


Re: [PERFORM] How to profile an SQL script?

2008-12-03 Thread Andreas Kretschmer
Kynn Jones [EMAIL PROTECTED] schrieb:

 Hi.  I have a longish collection of SQL statements stored in a file that I run
 periodically via cron.  Running this script takes a bit too long, even for a
 cron job, and I would like to streamline it.
 
 Is there a way to tell Postgres to print out, after each SQL statement is
 executed, how long it took to execute?

Do you run this with psql? You can switch on timing-output, with
\timing. It displays after each statement the run-time for this
statement.


Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.  (Linus Torvalds)
If I was god, I would recompile penguin with --enable-fly.   (unknown)
Kaufbach, Saxony, Germany, Europe.  N 51.05082°, E 13.56889°

-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


Re: [PERFORM] How to profile an SQL script?

2008-12-03 Thread Heikki Linnakangas

Andreas Kretschmer wrote:

Kynn Jones [EMAIL PROTECTED] schrieb:


Hi.  I have a longish collection of SQL statements stored in a file that I run
periodically via cron.  Running this script takes a bit too long, even for a
cron job, and I would like to streamline it.

Is there a way to tell Postgres to print out, after each SQL statement is
executed, how long it took to execute?


Do you run this with psql? You can switch on timing-output, with
\timing. It displays after each statement the run-time for this
statement.


See also log_duration and log_min_duration settings.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


Re: [PERFORM] How to profile an SQL script?

2008-12-03 Thread Kynn Jones
Andreas, Heikki:

Thanks!
Kynn