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 5DEDC5E3639 for ; Sun, 15 Aug 2004 15:24:19 -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 57935-07 for ; Sun, 15 Aug 2004 18:24:13 +0000 (GMT) Received: from jalapeno.crazydogs.org (jalapeno.jellybean.co.uk [212.78.70.100]) by svr1.postgresql.org (Postfix) with ESMTP id 1C36C5E46CD for ; Sun, 15 Aug 2004 15:24:11 -0300 (ADT) Received: from rp by jalapeno.crazydogs.org with local (Exim 3.36 #1 (Debian)) id 1BwPfs-0001Y2-00 for ; Sun, 15 Aug 2004 19:24:08 +0100 Date: Sun, 15 Aug 2004 19:24:08 +0100 From: Richard Poole To: pgsql-performance@postgresql.org Subject: Re: Help interpreting explain analyze output Message-ID: <20040815182407.GA21608@guests.deus.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/241 X-Sequence-Number: 7877 On Sun, Aug 15, 2004 at 07:47:53PM +0200, Ole Tange wrote: > QUERY PLAN > --------------------------------------------------------------------------------------------------------------------------------------------------------------------- > Unique (cost=5680.00..5766.70 rows=8670 width=26) (actual > time=17030.802..20044.614 rows=68213 loops=1) > InitPlan > -> Index Scan using hostname_hostname_key on hostname > (cost=0.00..5.42 rows=1 width=4) (actual time=0.101..0.106 rows=1 loops=1) > Index Cond: (hostname = 'www.forbrug.dk'::text) > -> Sort (cost=5674.58..5696.25 rows=8670 width=26) (actual > time=17030.792..17689.650 rows=174714 loops=1) > Sort Key: h.sessionid, '2004-33'::text, nd.niveau > -> Merge Join (cost=4500.70..5107.48 rows=8670 width=26) > (actual time=3226.955..3966.011 rows=174714 loops=1) > Merge Cond: ("outer".pathid = "inner".pathid) > -> Index Scan using niveaudir_pathid on niveaudir nd > (cost=0.00..465.59 rows=22715 width=26) (actual time=0.181..52.248 > rows=22330 loops=1) > -> Sort (cost=4500.70..4522.38 rows=8670 width=8) (actual > time=3226.666..3443.092 rows=174714 loops=1) > Sort Key: h.pathid > -> Index Scan using httplog_hitdatetime on httplog h > (cost=0.00..3933.61 rows=8670 width=8) (actual time=0.425..1048.428 > rows=174714 loops=1) > Index Cond: (hitdatetime > '2004-08-14 > 16:41:16.855829+02'::timestamp with time zone) > Filter: ((hostid = $0) AND (statusid <> 404)) > Total runtime: 20478.174 ms > (15 rows) > > As I read it the output tells me what was done during the milliseconds: The first time given is not the time when this stage of the plan starts to execute, but the time when it returns its first row. So most of the time in this query is being spent doing the two sorts - in a sort, of course, most of the work has to be done before any rows can be returned. Richard