Re: Very long deletion time on a 200 GB database

From: Marcin Mańk <marcin(dot)mank(at)gmail(dot)com>
To: "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Very long deletion time on a 200 GB database
Date: 2012-02-23 10:07:47
Message-ID: CAK61fk6bSQtmDUzm2rNv33kN4Oar_dYZ-yFEa9zR_zLL8L9esQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> DELETE FROM  B
> WHERE r_id IN (SELECT R.id
>     FROM R, B
>    WHERE r.end_date < (NOW() - (interval '1 day' * 30))
>      AND r.id = b.r_id
>

How about:

DELETE FROM  B
WHERE r_id IN (SELECT distinct R.id
    FROM R  WHERE r.end_date < (NOW() - (interval '1 day' * 30))

?

Greetings
Marcin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Huxton 2012-02-23 11:23:09 Re: Very long deletion time on a 200 GB database
Previous Message Glyn Astill 2012-02-23 09:50:20 Re: Very long deletion time on a 200 GB database