Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 6F980642C28 for ; Mon, 17 May 2010 09:28:27 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 62675-02 for ; Mon, 17 May 2010 12:28:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by mail.postgresql.org (Postfix) with ESMTP id CD664642C13 for ; Mon, 17 May 2010 09:28:19 -0300 (ADT) Received: from webserv.wug.de ([194.25.154.138]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0M6fVk-1NK4vd0dHQ-00wi3L; Mon, 17 May 2010 14:28:17 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1ODzQe-0004sz-00 for pgsql-performance@postgresql.org; Mon, 17 May 2010 14:28:16 +0200 Date: Mon, 17 May 2010 14:28:16 +0200 From: "A. Kretschmer" To: pgsql-performance@postgresql.org Subject: Re: Slow Bulk Delete Message-ID: <20100517122816.GA31501@a-kretschmer.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: Debian/GNU Linux - weil ich es mir Wert bin! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX19s4pziPjw8Fz//B7AK8LjBP9A+DFPOrQoN3QV nUWJ0nxHCxdC5xbMR/3n/FKjWJjMC2/SnF4BIxBO/fs6NMK4hx mGGz1fqDbechX9tAMlhXg== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.009 tagged_above=-10 required=5 tests=BAYES_20=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_FRT_CONTACT=0.01 X-Spam-Level: X-Archive-Number: 201005/92 X-Sequence-Number: 38676 In response to Jon Nelson : > On Mon, May 17, 2010 at 5:10 AM, Pierre C wrote: > > - or use a JOIN delete with a virtual VALUES table > > - or fill a temp table with ids and use a JOIN DELETE > > What is a virtual VALUES table? Can you give me an example of using a > virtual table with selects, joins, and also deletes? Something like this: test=# select * from foo; c1 ---- 1 2 3 4 (4 rows) test=*# delete from foo using (values (1),(2) ) as bla where foo.c1=bla.column1; DELETE 2 test=*# select * from foo; c1 ---- 3 4 (2 rows) values (1), (2) as bla -> returns a 'virtual table' bla with one column column1. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99