Fwd: Re: Slow subquery on large dataset

Поиск
Список
Период
Сортировка
От daq
Тема Fwd: Re: Slow subquery on large dataset
Дата
Msg-id 483454830.20040221134220@ugyvitelszolgaltato.hu
обсуждение исходный текст
Список pgsql-novice
B> foo=# SELECT data_id FROM capacity_data WHERE data_id NOT IN (SELECT
B> data_id FROM capacities);

Don't use the IN operator if it posible! Too slow.

Select data_id from capacity_data where not exists(select * from capacities where
capacity_data.data_id::bigint=capacities.data_id);

Note the "::bigint" cast. If you don't cast capacity_data.data_id to bigint
Postgres will not use the pk index on capacities table. You must cast, or use BIGSERIAL type in capacity_data.

DAQ


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

Предыдущее
От: joseph speigle
Дата:
Сообщение: Re: Create Rule
Следующее
От: Nabil Sayegh
Дата:
Сообщение: easy backup?