Re: Performance Concern

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: Performance Concern
Дата
Msg-id 1067116415.3991.4.camel@fuji.krosing.net
обсуждение исходный текст
Ответ на Re: Performance Concern  ("John Pagakis" <thebfh@toolsmythe.com>)
Ответы Re: Performance Concern
Список pgsql-performance
John Pagakis kirjutas L, 25.10.2003 kell 12:56:

> I wrote a JAVA simulation of the above that did 1000 updates in 37 seconds.
> That left me scratching my head because in psql when I did the
> semi-equivalent:
>
> UPDATE baz SET customer_id = '1234' WHERE baz_key IN( SELECT baz_key FROM
> baz WHERE customer_id IS NULL LIMIT 1000 );

try it this way, maybe it will start using an index :

UPDATE baz
   SET customer_id = '1234'
 WHERE baz_key IN (
    SELECT baz_key
      FROM baz innerbaz
     WHERE customer_id IS NULL
       and innerbaz.baz_key = baz.baz_key
     LIMIT 1000 );

you may also try to add a conditional index to baz:

CREATE INDEX baz_key_with_null_custid_nxd
    ON  baz
 WHERE customer_id IS NULL;

to make the index access more efficient.

----------------
Hannu


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

Предыдущее
От: "John Pagakis"
Дата:
Сообщение: Re: Performance Concern
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: analyzing postgresql performance for dbt-2