On Wed, 2004-02-04 at 14:55, Mark Harrison wrote:
> testdb=# \d bigtable
>       Table "public.bigtable"
>   Column  |  Type   | Modifiers
> ---------+---------+-----------
>   id      | bigint  | not null
>   typeid  | integer | not null
>   reposid | integer | not null
> Indexes: bigtable_id_key unique btree (id)

> testdb=# explain select * from bigtable where id = 123;

Your column is a bigint but 123 defaults to type int. Indexes aren't
used when there's a type mismatch. Use an explicit cast or quote it:

  select * from bigtable where id = 123::bigint;

Or

  select * from bigtable where id = '123';

Corey



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to