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

Поиск
Список
Период
Сортировка
От Andrew J. Kopciuch
Тема Re: switching default integer datatype to int8 and "IN (...)" clause
Дата
Msg-id 200301090330.41238.akopciuch@bddf.ca
обсуждение исходный текст
Ответ на switching default integer datatype to int8 and "IN (...)" clause  (postgres@ied.com)
Ответы Re: switching default integer datatype to int8 and "IN (...)"
Список 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 по дате отправления:

Предыдущее
От: postgres@ied.com
Дата:
Сообщение: switching default integer datatype to int8 and "IN (...)" clause
Следующее
От: "Radu-Adrian Popescu"
Дата:
Сообщение: Re: PostgreSQL X Resin EE