Re: optimizing Postgres queries

Поиск
Список
Период
Сортировка
От Shridhar Daithankar
Тема Re: optimizing Postgres queries
Дата
Msg-id 200401051740.05006.shridhar_daithankar@myrealbox.com
обсуждение исходный текст
Ответ на Re: optimizing Postgres queries  (David Teran <david.teran@cluster9.com>)
Ответы Re: optimizing Postgres queries  (David Teran <david.teran@cluster9.com>)
Список pgsql-performance
On Monday 05 January 2004 17:35, David Teran wrote:
> explain analyze SELECT --columns-- FROM KEY_VALUE_META_DATA t0 WHERE
> t0.ID_FOREIGN_TABLE = 21110;
>
> i see that no index is being used whereas when i use
>
> explain analyze SELECT --columns-- FROM KEY_VALUE_META_DATA t0 WHERE
> t0.ID_FOREIGN_TABLE = 21110::bigint;
>
> an index is used. Very fine, the performance is about 10 to 100 times
> faster for the single select.
>
> I am using WebObjects with JDBC. I will now create a DB with integer
> instead of bigint and see how this performs.

The performance will likely to be the same. Its just that integer happens to
be default integer type and hence it does not need an explicit typecast. ( I
don't remember exactly which integer is default but it is either of int2,int4
and int8...:-))

The performance diffference is likely due to use of index, which is in turn
due to typecasting. If you need bigint, you should use them. Just remember to
typecast whenever required.

 Shridhar


В списке pgsql-performance по дате отправления:

Предыдущее
От: David Teran
Дата:
Сообщение: Re: optimizing Postgres queries
Следующее
От: David Teran
Дата:
Сообщение: Re: optimizing Postgres queries