Re: Using bigint needs explicit cast to use the index

From: Neil Conway <neilc(at)samurai(dot)com>
To: Steven Butler <stevenb(at)kjross(dot)com(dot)au>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Using bigint needs explicit cast to use the index
Date: 2004-03-08 00:43:58
Message-ID: 404BC1CE.3040009@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Steven Butler wrote:
> I've recently converted a database to use bigint for the indices. Suddenly
> simple queries like
>
> select * from new_test_result where parent_id = 2
>
> are doing full table scans instead of using the index.

This is fixed in CVS HEAD. In the mean time, you can enclose the
integer literal in single quotes, or explicitely cast it to the type
of the column.

FWIW, this is an FAQ.

-Neil

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-03-08 01:29:19 Re: speeding up a select with C function?
Previous Message Steven Butler 2004-03-08 00:26:21 Using bigint needs explicit cast to use the index