Re: Query using SeqScan instead of IndexScan - Mailing list pgsql-performance

From Jim Nasby
Subject Re: Query using SeqScan instead of IndexScan
Date
Msg-id B35559FB-1012-4C9A-811B-0F1D37462F34@pervasive.com
Whole thread Raw
In response to Re: Query using SeqScan instead of IndexScan  (Brendan Duddridge <brendan@clickspace.com>)
List pgsql-performance
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



pgsql-performance by date:

Previous
From: Jim Nasby
Date:
Subject: Re: Query using SeqScan instead of IndexScan
Next
From: "Mike Quinn"
Date:
Subject: Re: The order of fields around the "=" in the WHERE