Re: Postgres 8.1 choosing the larger index for an index scan

From: s anwar <sanwar(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Postgres 8.1 choosing the larger index for an index scan
Date: 2005-12-28 18:01:47
Message-ID: 3e3c86f90512281001u668ac8acgffff0937ea21f94f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

id1 is of integer type.

On 12/22/05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> s anwar <sanwar(at)gmail(dot)com> writes:
> > I have a very simple setup. I have one table with ~65000 tuples
> consuming
> > ~8500 pages (reltuples and relpages as per pg_class). I have defined two
> > indices on table, t1_id1 which indexes "t1(id1)" which consumes 194
> pages;
> > and t1_id1_v1 which indexes "t1(id1) where id1=3D9999" which consumes 4
> pag=
> > es.
> > When I run an "explain select * from t1 where id1=3D9999;" it chooses to
> > index-scan the t1_id1 index instead of t1_id1_v1 index, even though that
> th=
> > e
> > where-clause uses an equal comparison and there is a smaller index
> defined
> > on t1 limited to the value of id1 to 9999.
>
> What's the datatype of id1? There are some limitations in the current
> code about recognizing cross-type WHERE conditions ...
>
> regards, tom lane
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Randy Burkhardt 2005-12-29 00:11:30 ?linux distro?
Previous Message Christopher Browne 2005-12-28 17:11:30 Re: limiting number of allowed rows in a table