X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4F514D1B55D for ; Wed, 12 Nov 2003 16:11:16 +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 11269-09 for ; Wed, 12 Nov 2003 12:10:44 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 27CA6D1B50D for ; Wed, 12 Nov 2003 12:10:44 -0400 (AST) 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 hACGAY19009084; Wed, 12 Nov 2003 11:10:35 -0500 (EST) To: nickf@ontko.com Cc: "Manfred Koizar" , "Pgsql-Performance@Postgresql. Org" Subject: Re: Seeking help with a query that takes too long In-reply-to: References: Comments: In-reply-to "Nick Fankhauser" message dated "Wed, 12 Nov 2003 10:55:48 -0500" Date: Wed, 12 Nov 2003 11:10:34 -0500 Message-ID: <9083.1068653434@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/68 X-Sequence-Number: 4628 "Nick Fankhauser" writes: >> Nick, can you find out why this row count estimation is so far off? > It's actually correct: Sure, the 3501 was the "actual". The estimate was 1 row, which was pretty far off :-( > Here are the stats: It looks like you are running with the default statistics target (10). Try boosting it to 100 or even more for this column (see ALTER TABLE SET STATISTICS, then re-ANALYZE) and see if the estimate gets better. I think the major problem is likely here: > n_distinct | 24215 which is no doubt much too small (do you have an idea of the number of distinct actor_full_name_uppercase values?) regards, tom lane