Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 448D2650014 for ; Wed, 3 Dec 2008 15:40:34 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 71777-03 for ; Wed, 3 Dec 2008 15:40:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 137086.vserver.de (static-ip-62-75-137-86.inaddr.intergenia.de [62.75.137.86]) by mail.postgresql.org (Postfix) with ESMTP id 9816D64FD2E for ; Wed, 3 Dec 2008 15:40:25 -0400 (AST) Received: from a-kretschmer.de (p54B380B5.dip0.t-ipconnect.de [84.179.128.181]) (authenticated bits=0) by 137086.vserver.de (8.12.8/8.12.8) with ESMTP id mB3JeNMF011493 for ; Wed, 3 Dec 2008 20:40:23 +0100 Received: from kretschmer by a-kretschmer.de with local (Exim 4.69) (envelope-from ) id 1L7xaB-0002Ff-8Q for pgsql-performance@postgresql.org; Wed, 03 Dec 2008 20:40:23 +0100 Date: Wed, 3 Dec 2008 20:40:23 +0100 From: Andreas Kretschmer To: pgsql-performance@postgresql.org Subject: Re: How to profile an "SQL script"? Message-ID: <20081203194023.GA8541@tux> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! X-Lugdd: Gerd Kube X-Info: My name is root. Just root. And I am licensed to kill -9 User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/29 X-Sequence-Number: 32065 Kynn Jones 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°