pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: DeJuan Jackson <djackson@speedfc.com>
To: Tim McAuley <mcauleyt@tcd.ie>
Cc: pgsql-general@postgresql.org
Subject: Re: Unused Indexes
Date: Wed, 30 Jul 2003 08:26:40 -0500
Message-ID: <3F27C790.2030409@speedfc.com> (raw)
In-Reply-To: <3F27BE36.2090508@tcd.ie>
References: <3F27BE36.2090508@tcd.ie>

Assuming you have done a 'VACUUM ANALYZE' on the table in question you 
are most likely running into a type coercion issue.
So explicitly cast your constants to bigint and the index should start 
being considered.

  select id from <table> where col2 = 1::bigint and col2 = 1::bigint

Tim McAuley wrote:

> Hi,
>
> I have a table which I have populated with over 5000 entries. There is 
> a combined  index placed on two of the columns (both bigint). I am 
> trying a simple select (i.e. select id where col1 = 1 and col2 = 1) 
> covering these  two columns and it keeps using a seq scan. Is this 
> correct? I would have thought that with this number of entries that an 
> index scan should be used.
>
> I am testing this using postgresql 7.3.3 on windows 2000 using cygwin.
>
> Doing "set enable_seqscan to off" does not change the results of the 
> explain operation.
>
> I also tried setting a single index on just one of the columns and 
> running an appropriate search; it still uses a seq scan. At what stage 
> will the planner normally start using an index scan?
>
> Any hints appreciated.
>
> Tim
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster






view thread (13+ messages)  latest in thread

Message-ID: <3F27C790.2030409@speedfc.com>
Permalink:  ../3F27C790.2030409@speedfc.com/
Also on:    postgresql.org/message-id/3F27C790.2030409@speedfc.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-general@postgresql.org
  Cc: djackson@speedfc.com, mcauleyt@tcd.ie
  Subject: Re: Unused Indexes
  In-Reply-To: <3F27C790.2030409@speedfc.com>
  References: <3F27BE36.2090508@tcd.ie> <3F27C790.2030409@speedfc.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