Re: DELETE performance problem

Поиск
Список
Период
Сортировка
От Grzegorz Jaśkiewicz
Тема Re: DELETE performance problem
Дата
Msg-id 2f4958ff0911250816o55d53c78l2a2940ae0ce0c82c@mail.gmail.com
обсуждение исходный текст
Ответ на Re: DELETE performance problem  (Luca Tettamanti <kronos.it@gmail.com>)
Список pgsql-performance


On Wed, Nov 25, 2009 at 4:13 PM, Luca Tettamanti <kronos.it@gmail.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

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

Предыдущее
От: Luca Tettamanti
Дата:
Сообщение: Re: DELETE performance problem
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Query times change by orders of magnitude as DB ages