Bad performing DELETE

From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: pgsql-sql(at)postgresql(dot)org
Subject: Bad performing DELETE
Date: 2000-11-27 11:39:32
Message-ID: 3A2247F4.85C70143@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Boettcher 2000-11-27 11:44:23 removing a DB??
Previous Message Jens Hartwig 2000-11-27 11:34:38 Re: removing a DB??