Re: The type int8 and the use of indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: igorr(at)ifi(dot)uio(dot)no
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: The type int8 and the use of indexes
Date: 2001-01-26 15:20:17
Message-ID: 29644.980522417@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Igor V. Rafienko" <igorr(at)ifi(dot)uio(dot)no> writes:
> on Jan 25, 2001, 15:14, Stephan Szabo std::cout'ed:
> | select * from table where pk=1::int8 should use the index if pk is an
> | int8 column.

> Would that work for other operators (such as <, >, etc.) as well?

It's a necessary prerequisite, anyway.

> Last time I tried something similar on Postgres-7.0.2, the index was
> used on equality but not on "less-than" (the number of rows in the
> result was very small).

It won't use an index unless the optimizer knows that the number of
rows to be selected is small, which for a one-sided "<" query would
depend on where the endpoints of the data range are. Had you done
a VACUUM ANALYZE recently?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor V. Rafienko 2001-01-26 15:22:36 Re: The type int8 and the use of indexes
Previous Message Kassu Valtakari 2001-01-26 15:11:19 Connection pooling with C and libpq