X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F51DDBD91 for ; Fri, 25 Nov 2005 00:20:59 -0400 (AST) 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 19676-02-2 for ; Fri, 25 Nov 2005 04:20:56 +0000 (GMT) X-Greylist: delayed 01:05:44.879458 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 3AF93DBCA4 for ; Fri, 25 Nov 2005 00:20:55 -0400 (AST) Received: from pillage.dreamhost.com (pillage.dreamhost.com [66.33.213.23]) by svr2.postgresql.org (Postfix) with ESMTP id 30752F0B00 for ; Fri, 25 Nov 2005 03:15:17 +0000 (GMT) Received: from [127.0.0.1] (ip-66-33-217-47.dreamhost.com [66.33.217.47]) by pillage.dreamhost.com (Postfix) with ESMTP id B5B46BE8C for ; Thu, 24 Nov 2005 19:15:12 -0800 (PST) Message-ID: <438681E0.6070006@kylecordes.com> Date: Thu, 24 Nov 2005 21:15:44 -0600 From: Kyle Cordes User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> <17380.1132886273@sss.pgh.pa.us> In-Reply-To: <17380.1132886273@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/507 X-Sequence-Number: 15764 Tom Lane wrote: >What "same result"? You only ran it up to 2K rows, not 2M. In any >case, EXPLAIN without ANALYZE is pretty poor ammunition for complaining >that the planner made the wrong choice. I ran the same > Hello, sorry to jump in mid-stream, but this reminded me of something. I have hit cases where I have a query for which there is a somewhat "obvious" (to a human...) query plan that should make it possible to get a query answer pretty quickly. Yet the query "never" finishes (or rather, after hours of waiting I finally kill it). I assume this is because of a sub-optimal query plan. But, it appears that an EXPLAIN ANALYZE runs the actual query, so it takes as long as the actual query. In such a case, how can I go about tracking down the issue, up to an including a complaint about the query planner? :-) (Overall, I'm pretty pleased with the PG query planner; it often gets better results than another, popular commercial DBMS we use here.... that is just a general impression, not the result of setting up the same schema in each for a comparison.) Kyle Cordes www.kylecordes.com