Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 12B486336BE for ; Mon, 11 Jan 2010 07:25:14 -0400 (AST) 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 50393-05-2 for ; Mon, 11 Jan 2010 11:25:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 63.mail-out.ovh.net (63.mail-out.ovh.net [91.121.185.56]) by mail.postgresql.org (Postfix) with SMTP id BA3F7633891 for ; Mon, 11 Jan 2010 07:24:47 -0400 (AST) Received: (qmail 22521 invoked by uid 503); 11 Jan 2010 11:25:22 -0000 Received: from b6.ovh.net (HELO mail609.ha.ovh.net) (213.186.33.56) by 63.mail-out.ovh.net with SMTP; 11 Jan 2010 11:25:22 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 11 Jan 2010 11:24:46 -0000 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO soyouz) (88.161.102.87) by ns0.ovh.net with SMTP; 11 Jan 2010 11:24:45 -0000 Date: Mon, 11 Jan 2010 12:25:26 +0100 To: "Robert Haas" Subject: Re: PG optimization question From: =?utf-8?Q?Pierre_Fr=C3=A9d=C3=A9ric_Caillau?= =?utf-8?Q?d?= Cc: "Hannu Krosing" , Nickolay , pgsql-performance@postgresql.org Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <4B485975.70506@zhukcity.ru> <2f4958ff1001090418i78dee992t5ff2d78a54187c07@mail.gmail.com> <4B4879A0.2060703@zhukcity.ru> <20100109124646.GA8123@it.is.rice.edu> <4B487D9C.9020507@zhukcity.ru> <4B48CFDF.7090406@zhukcity.ru> <1263075977.6481.9.camel@hvost> <603c8f071001101045wb99b337j3e1dabe9ead97421@mail.gmail.com> Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <603c8f071001101045wb99b337j3e1dabe9ead97421@mail.gmail.com> User-Agent: Opera Mail/9.62 (Linux) X-Ovh-Tracer-Id: 755760312908514960 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/186 X-Sequence-Number: 37066 On Sun, 10 Jan 2010 19:45:32 +0100, Robert Haas wrote: > 2010/1/10 Pierre Frédéric Caillaud : >> >>> If you transfer (delete from staging, insert into archive) in one >>> transaction , then it will be always visible in exactly one of them, >>> and exatly once in a view over both staging and archive(s). >> >>        Does the latest version implement this : >> >> INSERT INTO archive (...) DELETE FROM staging WHERE ... RETURNING ... > > No. There are no plans to support that, though there are proposals to > support: > > WITH x AS (DELETE FROM staging WHERE ... RETURNING ...) INSERT INTO > archive (...) SELECT ... FROM x > > I'm not sure how much that will help though since, in the designs so > far discused, the tuples won't be pipelined. > > ...Robert > Yeah, but it's a lot more user-friendly than SELECT FOR UPDATE, INSERT SELECT, DELETE...