From: | Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com> |
---|---|
To: | Luca Tettamanti <kronos(dot)it(at)gmail(dot)com> |
Cc: | marcin mank <marcin(dot)mank(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: DELETE performance problem |
Date: | 2009-11-25 16:16:00 |
Message-ID: | 2f4958ff0911250816o55d53c78l2a2940ae0ce0c82c@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Wed, Nov 25, 2009 at 4:13 PM, Luca Tettamanti <kronos(dot)it(at)gmail(dot)com>wrote:
>
>
> DELETE FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t1.annotation_id =
> t2.annotation_id)
>
> performs event better:
>
> Seq Scan on t1 (cost=0.00..170388415.89 rows=22937406 width=6) (actual
> time=272.625..561241.294 rows=26185953 loops=1)
> Filter: (subplan)
> SubPlan
> -> Index Scan using t2_idx on t2 (cost=0.00..1113.63 rows=301
> width=0) (actual time=0.008..0.008 rows=1 loops=45874812)
> Index Cond: ($0 = annotation_id)
> Total runtime: 629426.014 ms
> (6 rows)
>
> Have you tried:
DELETE FROM t1 USING t2 WHERE t1.annotation_id = t2.annotation_id;
?
--
GJ
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2009-11-25 16:26:15 | Re: Query times change by orders of magnitude as DB ages |
Previous Message | Luca Tettamanti | 2009-11-25 16:13:09 | Re: DELETE performance problem |