pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim Nasby <jnasby@pervasive.com>
To: Brendan Duddridge <brendan@clickspace.com>
Cc: chris smith <dmagick@gmail.com>
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Re: Query using SeqScan instead of IndexScan
Date: Tue, 4 Apr 2006 16:28:24 -0400
Message-ID: <B35559FB-1012-4C9A-811B-0F1D37462F34@pervasive.com> (raw)
In-Reply-To: <95C1A48B-A76F-4F9B-B5EE-0BFAF8873067@clickspace.com>
References: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com>
	<20060331155911.GP49405@pervasive.com>
	<EBEB7ACF-84A8-4FCF-A481-8C087FF372D1@clickspace.com>
	<3c1395330603311723i368092f2jf0c2291ab033ae2a@mail.gmail.com>
	<20060401153247.GI49405@pervasive.com>
	<95C1A48B-A76F-4F9B-B5EE-0BFAF8873067@clickspace.com>

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





view thread (18+ messages)

Message-ID: <B35559FB-1012-4C9A-811B-0F1D37462F34@pervasive.com>
Permalink:  ../B35559FB-1012-4C9A-811B-0F1D37462F34@pervasive.com/
Also on:    postgresql.org/message-id/B35559FB-1012-4C9A-811B-0F1D37462F34@pervasive.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: jnasby@pervasive.com, brendan@clickspace.com, dmagick@gmail.com
  Subject: Re: Query using SeqScan instead of IndexScan
  In-Reply-To: <B35559FB-1012-4C9A-811B-0F1D37462F34@pervasive.com>
  References: <2F1712F1-E5E2-455E-A291-06F300A66549@clickspace.com> <20060331155911.GP49405@pervasive.com> <EBEB7ACF-84A8-4FCF-A481-8C087FF372D1@clickspace.com> <3c1395330603311723i368092f2jf0c2291ab033ae2a@mail.gmail.com> <20060401153247.GI49405@pervasive.com> <95C1A48B-A76F-4F9B-B5EE-0BFAF8873067@clickspace.com> <B35559FB-1012-4C9A-811B-0F1D37462F34@pervasive.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox