X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 45075D1B503 for ; Sun, 28 Sep 2003 16:13:50 +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 72057-10 for ; Sun, 28 Sep 2003 13:13:40 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 83EC4D1B4EC for ; Sun, 28 Sep 2003 13:13:39 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8SGDM6c009443; Sun, 28 Sep 2003 12:13:22 -0400 (EDT) To: holger@marzen.de Cc: David Griffiths , pgsql-general@postgresql.org Subject: Re: Tuning/performance question. In-reply-to: References: <01d201c38573$84606930$6501a8c0@griffiths2> Comments: In-reply-to Holger Marzen message dated "Sun, 28 Sep 2003 13:13:54 +0200" Date: Sun, 28 Sep 2003 12:13:22 -0400 Message-ID: <9442.1064765602@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/1737 X-Sequence-Number: 49956 Holger Marzen writes: > But many users compain about PostgreSQL's poor count(*) performance, I don't think that's relevant here. Some other DB's have shortcuts for determining the total number of rows in a single table, that is they can do "SELECT COUNT(*) FROM a_table" quickly, but David's query is messy enough that I can't believe anyone can actually do it without forming the join result. What I'd ask for is EXPLAIN ANALYZE output. Usually, if a complex query is slower than it should be, it's because the planner is picking a bad plan. So you need to look at how its estimates diverge from reality. But plain EXPLAIN doesn't show the reality, only the estimates ... David, could we see EXPLAIN ANALYZE for the query, and also the table schemas (psql \d displays would do)? Also, please take it to pgsql-performance, it's not really on-topic for pgsql-general. regards, tom lane