Performance Killer 'IN' ?

Поиск
Список
Период
Сортировка
От Kai Hessing
Тема Performance Killer 'IN' ?
Дата
Msg-id 492752FmfdpeU1@individual.net
обсуждение исходный текст
Ответы Re: Performance Killer 'IN' ?  (Kai Hessing <kai.hessing@hobsons.de>)
Список pgsql-general
Hossa,

I just made a little test on our test-database. I have an excel sheet
with about 2000 entries that should be updated with the same value. In a
first try I generated an SQL-Syntax for every entry like:

UPDATE xyz SET status=-6 WHERE id=xyz1 AND status>-1;
UPDATE xyz SET status=-6 WHERE id=xyz2 AND status>-1;
UPDATE xyz SET status=-6 WHERE id=... AND status>-1;

The execution of the ~2000 SQL-commands took about 5-10 seconds.

Then I tried the same with generating only one request using IN with the
twothousand entries like:

UPDATE xyz WHERE id IN (xyz1, xyz2, ....) AND status>-1;

and it took about 10 Minutes to execute. So it is nearly a hundred times
slower. Can this be verified? Is there anything that can be done about
that? Else I would need to have a few words with our programmers...

By the way the testsystem is a basic Suse 9.3 with a default postgres
installation 8.0.x

Thanks and
*greets*
Kai

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

Предыдущее
От: "Bozhidar Mihaylov"
Дата:
Сообщение: Slony-I for circular replication
Следующее
От: Kai Hessing
Дата:
Сообщение: Re: Performance Killer 'IN' ?