Re: [PERFORMANCE] slow small delete on large table - Mailing list pgsql-performance

From Christopher Kings-Lynne
Subject Re: [PERFORMANCE] slow small delete on large table
Date
Msg-id 403AB818.9090100@familyhealth.com.au
Whole thread Raw
In response to [PERFORMANCE] slow small delete on large table  ("Ed L." <pgsql@bluepolka.net>)
List pgsql-performance
> Of course, that's not legal 7.3.4 syntax.  These are both too
> slow due to sequential scan of table:
>
>     delete from mytable where key in (
>         select key
>         from mytable
>         where posteddatetime < now() - '90 days'
>         limit 100);

Upgrade to 7.4 - the query above will be vastly faster.

>     delete from mytable where exists (
>         select m.key
>         from mytable m
>         where m.key = mytable.key
>           and m.posteddatetime < now() - '90 days'
>         limit 100);

That one I used to use on 7.3 - I seem to recall it indexed nicely.

Chris

pgsql-performance by date:

Previous
From: "Ed L."
Date:
Subject: [PERFORMANCE] slow small delete on large table
Next
From: Bruno Wolff III
Date:
Subject: Re: [PERFORMANCE] slow small delete on large table