Received: from bachata.cybertec.at (TK212017082249.teleweb.at [212.17.82.249]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eARBdIt39575 for ; Mon, 27 Nov 2000 06:39:18 -0500 (EST) (envelope-from hs@cybertec.at) Received: from cybertec.at (IDENT:hs@home [195.34.147.7]) by bachata.cybertec.at (8.11.0/8.11.0) with ESMTP id eARCu9e20562 for ; Mon, 27 Nov 2000 13:56:09 +0100 Message-ID: <3A2247F4.85C70143@cybertec.at> Date: Mon, 27 Nov 2000 12:39:32 +0100 From: =?iso-8859-1?Q?Hans=2DJ=FCrgen=20Sch=F6nig?= X-Mailer: Mozilla 4.75 [de] (X11; U; Linux 2.2.16-22 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Bad performing DELETE References: <20001127124423.A26525@erm1.u-strasbg.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/238 X-Sequence-Number: 269 > 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