Re: how to speed up query

From: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: how to speed up query
Date: 2007-06-11 21:16:47
Message-ID: 1181596607.159164.9790@w5g2000hsg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jun 11, 2:23 pm, "Andrus" <kobrule(dot)(dot)(dot)(at)hot(dot)ee> wrote:
> I tried
>
> CREATE TEMP TABLE mydel AS
> SELECT r.dokumnr
> FROM rid r
> LEFT JOIN dok d USING (dokumnr)
> WHERE d.dokumnr IS NULL;
> DELETE FROM rid USING mydel WHERE rid.dokumnr =mydel.dokumnr;
> drop table mydel;
>
> and this runs 1 seconds intead for 2.2 hours.
>
> Thank you very much.
> This works!
>
> It's sad that PostgreSQL cannot optimize this delete statement
> automatically.

1 second does sound a lot better than 2 hours, doesn't it? :)
As to why Postgres seems to fail, I cannot say any more, as your
description is unclear. I am pretty sure there is some
misunderstanding, though.

Regards
Erwin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message lhaj.merigh@gmail.com 2007-06-11 21:23:59 Create a table B with data coming from table A
Previous Message Erwin Brandstetter 2007-06-11 21:10:53 Re: how to speed up query