Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2NFxVw55108 for ; Fri, 23 Mar 2001 10:59:31 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f2NFuN618067; Fri, 23 Mar 2001 10:56:23 -0500 (EST) To: "postgresql" cc: "Jan Wieck" , "PgSQL-SQL" Subject: Re: creating "job numbers" In-reply-to: <200103231307.f2ND7qw49017@mail.postgresql.org> References: <200103231307.f2ND7qw49017@mail.postgresql.org> Comments: In-reply-to "postgresql" message dated "Fri, 23 Mar 2001 08:16:26 -0500" Date: Fri, 23 Mar 2001 10:56:23 -0500 Message-ID: <18064.985362983@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200103/463 X-Sequence-Number: 2131 "postgresql" writes: > Using the serial data type... I don't understand when the backend > would skip a number. The value returned by a nextval() call will not be returned again by other nextval() calls, even if the surrounding transaction is later rolled back. Agreed, this isn't in line with full transactional semantics, but it was deemed the more useful thing to do precisely because of that. If you want the other behavior you can build it yourself, whereas there's no way to build the actual behavior of sequence objects in plain SQL. The reason why this is more useful is that with this behavior, acquirers of serial numbers don't need to wait for each other. A no-skipped-numbers implementation requires each would-be acquirer to block waiting to see if previous acquirers commit or not. You get no concurrency at all if you build your system like that. regards, tom lane