Re: Using indices with long unique IDs. - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Using indices with long unique IDs.
Date
Msg-id 20040109122524.GA16604@dcc.uchile.cl
Whole thread Raw
In response to Re: Using indices with long unique IDs.  ("D. Dante Lorenso" <dante@lorenso.com>)
List pgsql-general
On Fri, Jan 09, 2004 at 04:11:08AM -0600, D. Dante Lorenso wrote:
> Sergey Olefir wrote:
>
> >So the logical choice would be int8, right? Unfortunately quite wrong.
> >Statement of the form: "SELECT * FROM table WHERE id=1"
> >will never use index for id (assumming id is int8) since '1' is of type
> >int4. This is confirmed both by documentation and SQL EXPLAIN (after set
> >enable_seqscan TO 'off').

I think you can use WHERE id=cast(1 AS bigint)


> Well, that just plain sucks.  That means I've gotta go back and
> add casts to all my queries?
>
> Tell me it isn't so!

Yeah, it is :-(  AFAIU it is fixed in the current development version,
but who knows if it will be done in time before you tables grow too big ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Porque francamente, si para saber manejarse a uno mismo hubiera que
rendir examen... ¿Quién es el machito que tendría carnet?"  (Mafalda)

pgsql-general by date:

Previous
From: "D. Dante Lorenso"
Date:
Subject: Re: Using indices with long unique IDs.
Next
From: David Helgason
Date:
Subject: array faults?