Re: switching default integer datatype to int8 and "IN (...)" clause - Mailing list pgsql-sql

From Andrew J. Kopciuch
Subject Re: switching default integer datatype to int8 and "IN (...)" clause
Date
Msg-id 200301090330.41238.akopciuch@bddf.ca
Whole thread Raw
In response to switching default integer datatype to int8 and "IN (...)" clause  (postgres@ied.com)
Responses Re: switching default integer datatype to int8 and "IN (...)"
List 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


pgsql-sql by date:

Previous
From: postgres@ied.com
Date:
Subject: switching default integer datatype to int8 and "IN (...)" clause
Next
From: "Radu-Adrian Popescu"
Date:
Subject: Re: PostgreSQL X Resin EE