Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 77000B607B1 for ; Tue, 31 May 2011 10:33:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 17570-04 for ; Tue, 31 May 2011 13:33:35 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 37036B60824 for ; Tue, 31 May 2011 10:33:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p4VDXYQb025525; Tue, 31 May 2011 09:33:34 -0400 (EDT) To: Tomasz Chmielewski cc: Scott Marlowe , Tatsuo Ishii , Kevin Grittner , pgsql-hackers@postgresql.org Subject: pgpool versus sequences (was Re: [ADMIN] 'SGT DETAIL: Could not open file "pg_clog/05DC": No such file or directory' - what to do now?) In-reply-to: <4DE4A652.2040301@wpkg.org> References: <4DC0F063.70306@wpkg.org> <4DC15137020000250003D295@gw.wicourts.gov> <4DC19CD1.7070600@wpkg.org> <4DC1B378.6050105@wpkg.org> <4DC1B6C0.2000507@wpkg.org> <4DC3B469.80004@wpkg.org> <4DC5B754.3040506@wpkg.org> <4DE360D9.5060300@wpkg.org> <16063.1306811813@sss.pgh.pa.us> <4DE4A652.2040301@wpkg.org> Comments: In-reply-to Tomasz Chmielewski message dated "Tue, 31 May 2011 10:26:58 +0200" Date: Tue, 31 May 2011 09:33:34 -0400 Message-ID: <25524.1306848814@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/1582 X-Sequence-Number: 188616 Tomasz Chmielewski writes: > On 31.05.2011 05:16, Tom Lane wrote: >> I think the most appropriate solution may be to disallow SELECT FOR >> UPDATE/SHARE on sequences ... so if you have a good reason why we >> shouldn't do so, please explain it. > I grepped the sources of the application using postgres, and it certainly doesn't do it. > [ but pgpool does, as of a couple months ago ] > This is a message explaining why it was introduced to pgpool: > http://comments.gmane.org/gmane.comp.db.postgresql.pgpool.devel/348 Too bad that wasn't mentioned on pgsql-hackers, where someone might have pointed out the major flaws in the idea. > 2) is pgpool behaviour correct? No. Quite aside from the lack-of-XID-maintenance problem, the proposal seems just plain bizarre to me. SELECT FOR UPDATE wouldn't block nextval(), so the command doesn't actually guarantee serialization of sequence value acquisition. Taking a table lock on the sequence could do so, and wouldn't run into any implementation issues, so I fail to see why that alternative was rejected. I'm also wondering a bit how one determines *which* sequence to lock, in a case where the table has multiple serial columns ... regards, tom lane