pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <andrew@libertyrms.info>
To: pgsql-performance@postgresql.org
Subject: Re: Query not using the index
Date: Tue, 25 Feb 2003 07:44:50 -0500
Message-ID: <20030225074450.A16284@mail.libertyrms.com> (raw)
In-Reply-To: <200302251903.40364.mark@transportservices.com.au>
References: <200302251903.40364.mark@transportservices.com.au>

On Tue, Feb 25, 2003 at 07:03:40PM +1100, Mark Halliwell wrote:

> The majority of records (about 6.8 million) have computer = 8 with sequence 
> starting at 2200000 and incrementing by 1.
> There are about 497000 records with computer = 3 with the sequence starting at 
> 1 and also incrementing by 1.
> There are only a few records with other computer numbers.

> select * from replicate where computer = 3 and sequence >= 490000;
> 
> I have created several different indexes (always doing a vacuum analyse 
> afterwards etc), but the explain always reports a sequential scan.  If I 

Try setting the statistics on computer to a much wider value -- say

	ALTER TABLE computer ALTER COLUMN computer SET STATISTICS 1000

and see if it helps.  You can poke around in the pg_stats view to see
why this might help, and perhaps to get a more realistic idea of what
you need to set the statistics to.  The problem is likely the
overwhelming commonality of computer=8.

A

-- 
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110




view thread (4+ messages)  latest in thread

Message-ID: <20030225074450.A16284@mail.libertyrms.com>
Permalink:  ../20030225074450.A16284@mail.libertyrms.com/
Also on:    postgresql.org/message-id/20030225074450.A16284@mail.libertyrms.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: andrew@libertyrms.info
  Subject: Re: Query not using the index
  In-Reply-To: <20030225074450.A16284@mail.libertyrms.com>
  References: <200302251903.40364.mark@transportservices.com.au> <20030225074450.A16284@mail.libertyrms.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