pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hans-Jürgen Schönig <hs@cybertec.at>
To: pgsql-sql@postgresql.org
Subject: Bad performing DELETE
Date: Mon, 27 Nov 2000 12:39:32 +0100
Message-ID: <3A2247F4.85C70143@cybertec.at> (raw)
References: <20001127124423.A26525@erm1.u-strasbg.fr>

>

I have two tables: t_haus is about 1400 row and t_host has 364000 entries.
Both tables are indexed on edvnr. I did a vacuum on my db and all indices
are rebuild.
I want to delete all Entries in t_haus where a row can be found in t_host.
When using "delete from t_haus where t_haus.edvnr=t_host.edvnr; " the
database performs extremely bad.

 explain delete from t_haus where t_haus.edvnr=t_host.edvnr;

NOTICE:  QUERY PLAN:

Merge Join  (cost=52178.53..56754.63 rows=6299767 width=14)
  ->  Sort  (cost=52038.25..52038.25 rows=364359 width=4)
        ->  Seq Scan on t_host  (cost=0.00..11700.59 rows=364359 width=4)
  ->  Sort  (cost=140.27..140.27 rows=1729 width=10)
        ->  Seq Scan on t_haus  (cost=0.00..47.29 rows=1729 width=10)

EXPLAIN

What can I do to speed it up?
I've also had troubles with DELETE before (when doing joins in the
WHERE clause).

    Hans




view thread (2+ messages)  latest in thread

Message-ID: <3A2247F4.85C70143@cybertec.at>
Permalink:  ../3A2247F4.85C70143@cybertec.at/
Also on:    postgresql.org/message-id/3A2247F4.85C70143@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: hs@cybertec.at
  Subject: Re: Bad performing DELETE
  In-Reply-To: <3A2247F4.85C70143@cybertec.at>
  References: <20001127124423.A26525@erm1.u-strasbg.fr> <3A2247F4.85C70143@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox