Search Postgresql Archives

Performance Killer 'IN' ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux