X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D547D53689 for ; Tue, 12 Apr 2005 11:44:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17262-06 for ; Tue, 12 Apr 2005 14:44:25 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 29122534F3 for ; Tue, 12 Apr 2005 11:44:24 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3CEi0N6021160 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Apr 2005 08:44:02 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3CEi0bk088490; Tue, 12 Apr 2005 08:44:00 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3CEhxkY088489; Tue, 12 Apr 2005 08:43:59 -0600 (MDT) (envelope-from mfuhr) Date: Tue, 12 Apr 2005 08:43:59 -0600 From: Michael Fuhr To: hubert lubaczewski Cc: pgsql-performance@postgresql.org Subject: Re: profiling postgresql queries? Message-ID: <20050412144359.GA88387@winnie.fuhr.org> References: <20050412104643.GB11445@eo.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050412104643.GB11445@eo.pl> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/229 X-Sequence-Number: 11626 On Tue, Apr 12, 2005 at 12:46:43PM +0200, hubert lubaczewski wrote: > > the problem is that both the inserts and updated operate on > heavy-tirggered tables. > and it made me wonder - is there a way to tell how much time of backend > was spent on triggers, index updates and so on? > like: > total query time: 1 secons > trigger a: 0.50 second > trigger b: 0.25 second > index update: 0.1 second EXPLAIN ANALYZE in 8.1devel (CVS HEAD) prints a few statistics for triggers: EXPLAIN ANALYZE UPDATE foo SET x = 10 WHERE x = 20; QUERY PLAN ------------------------------------------------------------------------------------------------------------------ Index Scan using foo_x_idx on foo (cost=0.00..14.44 rows=10 width=22) (actual time=0.184..0.551 rows=7 loops=1) Index Cond: (x = 20) Trigger row_trig1: time=1.625 calls=7 Trigger row_trig2: time=1.346 calls=7 Trigger stmt_trig1: time=1.436 calls=1 Total runtime: 9.659 ms (6 rows) 8.1devel changes frequently (sometimes requiring initdb) and isn't suitable for production, but if the trigger statistics would be helpful then you could set up a test server and load a copy of your database into it. Just beware that because it's bleeding edge, it might destroy your data and it might behave differently than released versions. -- Michael Fuhr http://www.fuhr.org/~mfuhr/