Re: switching default integer datatype to int8 and "IN (...)" clause

From: "Andrew J(dot) Kopciuch" <akopciuch(at)bddf(dot)ca>
To: postgres(at)ied(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: switching default integer datatype to int8 and "IN (...)" clause
Date: 2003-01-09 10:30:41
Message-ID: 200301090330.41238.akopciuch@bddf.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> but a select like this takes ages (looooong time):
> # select * from file where id = 1921773;
> id | name
> -----+----------------
> 1921777 | icons
>

I believe the reason is this : the numeric literal is first considered an int4
becuase it falls within the range of int4 (-2147483648 to +2147483647).

try quoting the literal like this:

# select * from file where id = '1921773';

This forces the literal to be evaluated. If you do an explain on that query
... you should see that the query planner uses the index as expected and that
the condition used on the index is using the literal value cast to a big int.

That's just my understanding anyway.

Andy

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Radu-Adrian Popescu 2003-01-09 10:42:01 Re: PostgreSQL X Resin EE
Previous Message postgres 2003-01-09 09:24:12 switching default integer datatype to int8 and "IN (...)" clause