X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0AA2FD1B4C7 for ; Mon, 5 Jan 2004 16:19:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07692-05 for ; Mon, 5 Jan 2004 12:18:59 -0400 (AST) Received: from cayenne.palmdigitalmedia.com (cayenne.palmdigitalmedia.com [63.110.43.230]) by svr1.postgresql.org (Postfix) with SMTP id 33DCFD1B47C for ; Mon, 5 Jan 2004 12:19:00 -0400 (AST) Received: (qmail 20440 invoked from network); 5 Jan 2004 16:18:54 -0000 Received: from unknown (HELO ?192.168.124.23?) (63.110.43.226) by 0 with SMTP; 5 Jan 2004 16:18:54 -0000 User-Agent: Microsoft-Entourage/10.1.1.2418 Date: Mon, 05 Jan 2004 11:19:04 -0500 Subject: Re: Use my (date) index, darn it! From: John Siracusa To: Postgres Performance Message-ID: In-Reply-To: <22764.1073285743@sss.pgh.pa.us> Mime-version: 1.0 Reply-To: siracusa@mindspring.com Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/34 X-Sequence-Number: 5209 On 1/5/04 1:55 AM, Tom Lane wrote: > John Siracusa writes: >> Obviously the planner is making some bad choices here. > > A fair conclusion ... > >> I know that it is trying to avoid random seeks or other scary things >> implied by a "correlation" statistic that is not close to 1 or -1, but >> it is massively overestimating the hit caused by those seeks and >> seemingly not taking into account the size of the table! > > You haven't given any evidence to support these conclusions, though. Well here's what I was basing that theory on: before clustering, the correlation for the date column was around 0.3. After clustering, it was 1, and the index was always used. Does clustering change any other statistics other that correlation? I ran analyze immediately before and after the cluster operation. > Could we see some table schemas, EXPLAIN ANALYZE output, and relevant > pg_stats entries for the various cases? Well, the table is clustered now, so I can't reproduce the situation. Is there any way to "uncluster" a table? Should I just cluster it on a different column? -John