pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: dbadmin@nqadmin.com
Cc: pgsql-admin@postgresql.org
Subject: Re: Query Plan - Index Scan & Seq Scan
Date: Thu, 12 May 2005 15:11:36 -0400
Message-ID: <11484.1115925096@sss.pgh.pa.us> (raw)
In-Reply-To: <428387D2.8050200@nqadmin.com>
References: <428370AC.3070207@nqadmin.com>
	<886.1115910870@sss.pgh.pa.us>
	<428379E0.4010709@nqadmin.com>
	<2052.1115913920@sss.pgh.pa.us>
	<428381C3.80205@nqadmin.com>
	<6708.1115915406@sss.pgh.pa.us>
	<428387D2.8050200@nqadmin.com>

Prasanth <dbadmin@nqadmin.com> writes:
> Seems like having int2 after code is doing the trick.
> Can you please explain the reasons behind this.

When you write "int2col > 2", the operator that is selected is int2-gt-int4.
However the index on an int2 column can only deal with int2-gt-int2.

8.0 generalized the index mechanism enough to allow int2 indexes to deal
with int2-gt-int4, but in earlier releases you have to take care to make
the constant an int2.

int8 columns have the same issue from the other direction ...

			regards, tom lane



view thread (14+ messages)

Message-ID: <11484.1115925096@sss.pgh.pa.us>
Permalink:  ../11484.1115925096@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11484.1115925096@sss.pgh.pa.us

 · 

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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dbadmin@nqadmin.com
  Subject: Re: Query Plan - Index Scan & Seq Scan
  In-Reply-To: <11484.1115925096@sss.pgh.pa.us>
  References: <428370AC.3070207@nqadmin.com> <886.1115910870@sss.pgh.pa.us> <428379E0.4010709@nqadmin.com> <2052.1115913920@sss.pgh.pa.us> <428381C3.80205@nqadmin.com> <6708.1115915406@sss.pgh.pa.us> <428387D2.8050200@nqadmin.com> <11484.1115925096@sss.pgh.pa.us>

* 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