From: Heni Lolov <hal_bg@yahoo.com>
To: pgsql-admin@postgresql.org
Subject: indexes bug or feature
Date: Sat, 29 Dec 2001 09:16:46 -0800 (PST)
Message-ID: <20011229171646.77305.qmail@web21007.mail.yahoo.com> (raw)
In-Reply-To: <713.1009551875@sss.pgh.pa.us>
--- Tom Lane <tgl@sss.pgh.pa.us> wrote:
> You don't need to post questions four times ;-)
>
> Heni Lolov <hal_bg@yahoo.com> writes:
> > I have folowing table
>
> > create table usno(
> > reg_id int2,
> > id int2,
> > ra int4,
> > de int4,
> > mag_r int2,
> > mag_b int2
> > );
>
> > I make indexes in this order:
> > create index usno_drm_r on gsc_act(de,ra,mag_r);
> > create index usno_drm_b on gsc_act(de,ra,mag_b);
>
> > the problem is:
> > when I search on "de","ra" and "mag_b" or "de",
> "ra"
> > and "mag_r" Postgres uses always "usno_drm_r".
> > If I create the indexes in reversed order
> > "usno_drm_b" is always used.
>
> I bet that it's only using the first two columns of
> the index,
> so that it doesn't really matter which index is
> used. Are you
> being careful to cast the values compared to mag_r
> or mag_b to
> int2? "mag_r = 42" isn't indexable because 42 is an
> int4.
I am sure that the values are int2 and there is no
casting when I am using psql to examine this.
>
> regards, tom lane
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
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: hal_bg@yahoo.com
Subject: Re: indexes bug or feature
In-Reply-To: <20011229171646.77305.qmail@web21007.mail.yahoo.com>
References: <713.1009551875@sss.pgh.pa.us> <20011229171646.77305.qmail@web21007.mail.yahoo.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