Skip site navigation (1) Skip section navigation (2)

Re: Query Plan - Index Scan & Seq Scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dbadmin(at)nqadmin(dot)com
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Query Plan - Index Scan & Seq Scan
Date: 2005-05-12 19:11:36
Message-ID: 11484.1115925096@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-admin
Prasanth <dbadmin(at)nqadmin(dot)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

In response to

pgsql-admin by date

Next:From: Postgres AdminDate: 2005-05-12 19:12:14
Subject: ACT! and PostgreSQL
Previous:From: Scott MarloweDate: 2005-05-12 19:07:21
Subject: Re: memory allocation ; postgresql-8.0

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group