X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 81211D1B509 for ; Fri, 19 Sep 2003 08:04:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80993-08 for ; Fri, 19 Sep 2003 05:04:15 -0300 (ADT) Received: from jongert.nl (jongert.nl [194.109.59.87]) by svr1.postgresql.org (Postfix) with ESMTP id 97031D1B506 for ; Fri, 19 Sep 2003 05:04:12 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by jongert.nl (Postfix) with SMTP id 875B83C80C4; Fri, 19 Sep 2003 10:04:11 +0200 (CEST) X-AV-Checked: Fri Sep 19 10:04:11 2003 jongert.nl Received: from IT001 (IT001.int.jongert.nl [10.0.1.253]) by jongert.nl (Postfix) with SMTP id 5916A3C80B1 for ; Fri, 19 Sep 2003 10:04:11 +0200 (CEST) From: Cc: Subject: Re: is this explain good or bad??? Date: Fri, 19 Sep 2003 10:02:32 +0200 Message-ID: <003101c37e84$61b54b80$fd01000a@IT001> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <3F6AA786.1080404@klaster.net> Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/186 X-Sequence-Number: 15164 Here are the explain analyze versions: Best regards and thanx in advance Ries explain analyze select count(*) from sq_logfile; NOTICE: QUERY PLAN: Aggregate (cost=35988.07..35988.07 rows=1 width=0) (actual time=71907.64..71907.64 rows=1 loops=1) -> Seq Scan on sq_logfile (cost=0.00..33493.86 rows=997686 width=0) (actual time=12.90..46759.12 rows=997686 loops=1) Total runtime: 71907.76 msec explain analyze select count(*) from sq_flogile; NOTICE: QUERY PLAN: Aggregate (cost=128282.68..128282.68 rows=1 width=40) (actual time=99338.92..99338.92 rows=1 loops=1) -> Hash Join (cost=8.65..125788.46 rows=997686 width=40) (actual time=34.34..93123.02 rows=997686 loops=1) -> Hash Join (cost=6.49..105832.58 rows=997686 width=36) (actual time=23.94..78411.62 rows=997686 loops=1) -> Hash Join (cost=4.75..88371.34 rows=997686 width=32) (actual time=15.68..63115.86 rows=997686 loops=1) -> Hash Join (cost=3.69..68416.56 rows=997686 width=28) (actual time=12.56..45110.94 rows=997686 loops=1) -> Hash Join (cost=2.58..50955.94 rows=997686 width=24) (actual time=9.24..23160.42 rows=997686 loops=1) -> Seq Scan on sq_logfile sl (cost=0.00..33493.86 rows=997686 width=20) (actual time=5.72..11518.14 rows=997686 loops=1) -> Hash (cost=2.26..2.26 rows=126 width=4) (actual time=3.46..3.46 rows=0 loops=1) -> Seq Scan on sq_contenttypes ct (cost=0.00..2.26 rows=126 width=4) (actual time=2.88..3.17 rows=126 loops=1) -> Hash (cost=1.09..1.09 rows=9 width=4) (actual time=3.21..3.21 rows=0 loops=1) -> Seq Scan on sq_requestmethods rm (cost=0.00..1.09 rows=9 width=4) (actual time=3.16..3.19 rows=9 loops=1) -> Hash (cost=1.05..1.05 rows=5 width=4) (actual time=3.06..3.06 rows=0 loops=1) -> Seq Scan on sq_hierarchycodes hc (cost=0.00..1.05 rows=5 width=4) (actual time=3.04..3.05 rows=5 loops=1) -> Hash (cost=1.59..1.59 rows=59 width=4) (actual time=8.20..8.20 rows=0 loops=1) -> Seq Scan on sq_resultcodes rc (cost=0.00..1.59 rows=59 width=4) (actual time=7.93..8.07 rows=59 loops=1) -> Hash (cost=1.93..1.93 rows=93 width=4) (actual time=10.34..10.34 rows=0 loops=1) -> Seq Scan on sq_clientaddrfqdn cafqdn (cost=0.00..1.93 rows=93 width=4) (actual time=9.92..10.13 rows=93 loops=1) Total runtime: 99339.49 msec -----Oorspronkelijk bericht----- Van: Tomasz Myrta [mailto:jasiek@klaster.net] Verzonden: vrijdag 19 september 2003 8:52 Aan: ries@jongert.nl CC: pgsql-sql@postgresql.org Onderwerp: Re: [SQL] is this explain good or bad??? > explain select count(*) from sq_logfile; Not too helpful. Better choice is: explain analyze select * from sq_logfile; Your explains show that selecting from view is 4 times slower than selecting from a table (35988:128282). It is possible. Anyway counting 1 million rows usualy takes a long time... Regards, Tomasz Myrta