From: | Hannu Krosing <hannu(at)tm(dot)ee> |
---|---|
To: | thebfh(at)toolsmythe(dot)com |
Cc: | john(at)pagakis(dot)com, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Performance Concern |
Date: | 2003-10-25 21:13:36 |
Message-ID: | 1067116415.3991.4.camel@fuji.krosing.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Yonatan Goraly | 2003-10-25 21:25:37 | Slow performance with no apparent reason |
Previous Message | Reece Hart | 2003-10-25 17:49:00 | explicit casting required for index use |