| From: | Robert Berger <rwb(at)vtiscan(dot)com> |
|---|---|
| To: | hubert depesz lubaczewski <depesz(at)depesz(dot)pl> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: int8 indices? |
| Date: | 2001-08-07 15:50:08 |
| Message-ID: | 3B700E31.604E9135@vtiscan.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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?
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2001-08-07 16:00:56 | Re: Still wondering about random numbers... |
| Previous Message | Tom Lane | 2001-08-07 15:47:24 | Re: Database handle destroyed without explicit disconnect |