Re: int8 indices? - Mailing list pgsql-general

From Robert Berger
Subject Re: int8 indices?
Date
Msg-id 3B700E31.604E9135@vtiscan.com
Whole thread Raw
In response to int8 indices?  (hubert depesz lubaczewski <depesz@depesz.pl>)
List pgsql-general
I got burned by this recently and found the answer on the net:

When selecting on a column with an INT8 index, alway put
quotes around the constant value:

select * from a where id = '6970';

Otherwise the constant is assumed to be an INT4, which doesn't match the
type in the index, so the index is not used.



> of course i vacuum'ed, but when i select anything from the table i get
> seqscan:
> depesz=# explain select * from a where id = 6970;
> NOTICE:  QUERY PLAN:
>
> Seq Scan on a  (cost=0.00..465.76 rows=1 width=8)
>
> EXPLAIN
>
> what could be possible reason?
>

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Still wondering about random numbers...
Next
From: Thomas Lockhart
Date:
Subject: Re: user guide