How to echo statements in sourced file?

From: "Kynn Jones" <kynnjo(at)gmail(dot)com>
To: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: How to echo statements in sourced file?
Date: 2008-12-04 00:14:22
Message-ID: c2350ba40812031614q56622350j14ddd94d83131bff@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi. I have a 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 profile it.
I learned from Andreas Kretschmer (in another thread, in the
pgsql-performance list) about the \timing directive, which is useful for
this.

Now, after turning timing on, when I "source" the script from within psql,
with

mydb=> \i /path/to/my/script

...I get output lines like this

Time: 38.519 ms

right in my psql terminal after each statement in the file gets executed.

But now I need a way to have these statements that are being timed
themselves echoed to the terminal. Is there a way to do this?

TIA!

Kynn

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Harvey, Allan AC 2008-12-04 00:22:43 Re: How to echo statements in sourced file?
Previous Message Bruce Momjian 2008-12-03 22:26:37 Re: Monty on MySQL 5.1: "Oops, we did it again"