X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B674E11F61C9 for ; Tue, 4 Apr 2006 17:28:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69596-03 for ; Tue, 4 Apr 2006 17:28:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id A18AD11F6106 for ; Tue, 4 Apr 2006 17:28:41 -0300 (ADT) Received: from [172.30.3.138] (unknown [64.251.112.4]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by noel.decibel.org (Postfix) with ESMTP id 1908E56408; Tue, 4 Apr 2006 15:28:34 -0500 (CDT) In-Reply-To: <95C1A48B-A76F-4F9B-B5EE-0BFAF8873067@clickspace.com> References: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> <20060331155911.GP49405@pervasive.com> <3c1395330603311723i368092f2jf0c2291ab033ae2a@mail.gmail.com> <20060401153247.GI49405@pervasive.com> <95C1A48B-A76F-4F9B-B5EE-0BFAF8873067@clickspace.com> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: chris smith , PostgreSQL Performance Content-Transfer-Encoding: 7bit From: Jim Nasby Subject: Re: Query using SeqScan instead of IndexScan Date: Tue, 4 Apr 2006 16:28:24 -0400 To: Brendan Duddridge X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200604/53 X-Sequence-Number: 18137 On Apr 1, 2006, at 12:51 PM, Brendan Duddridge wrote: > from SELECT * FROM pg_stats WHERE tablename='table' AND > attname='category_id' > > I find correlation on category_product for category_id is 0.643703 > > Would setting the index on category_id to be clustered help with this? It would absolutely help on the query in question. In my experience, a correlation of 0.64 is too low to allow an index scan to be used for anything but a tiny number of rows. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461