Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYxDo-0003Tt-4L for pgsql-docs@arkaria.postgresql.org; Tue, 09 Jan 2018 16:57:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYxDn-0002qY-NP for pgsql-docs@arkaria.postgresql.org; Tue, 09 Jan 2018 16:57:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eYxDn-0002qN-I3 for pgsql-docs@lists.postgresql.org; Tue, 09 Jan 2018 16:57:55 +0000 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eYxDk-0006gu-LU for pgsql-docs@postgresql.org; Tue, 09 Jan 2018 16:57:55 +0000 Received: by mail-qk0-x236.google.com with SMTP id j185so8543673qkc.5 for ; Tue, 09 Jan 2018 08:57:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lP975KLc7/Rl36lw8QfWeN4qs0j0Vv046YQQMHq/3kg=; b=IJR0tVZ8F2q8L5cXq1psqKvMTHHlqZXCaP2hiwzkltjL//cybI5CQQNf6OLWSEyElv p55o1UuBAmiK3DxlrfSzO/7+r2eg7A6xTxU5NCVLP6/OVZsOLdUQY0oJp/jwiTTCuW60 IVF/TbQW0DUBhuxlfrZgqxUU6cQrEdu+k/B1hhSqZwP/48k41W3qjU0wXnKrX6XT4zMw 6Ltj/VGgqEmU45YOLJl62+naHGaJT4NgBk4Ecn/F6YoLl4gtuwA6wf5kDzERV7+ie4Bz oQG3QBugAsSBOIULSiCVCwqYeUw112sJLZF/P/6BcxClEOUnO9sahX+IPq5DR0NKK4qZ xNmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lP975KLc7/Rl36lw8QfWeN4qs0j0Vv046YQQMHq/3kg=; b=VNp31Pkxl1b9Yh+wC7bsQs5CQ5ZDHyK67n3jcpJaYilZX9EQDKz04LhJlT0Pt5QZ5J 3WBAMbOO4JvUqbPUSEwpfBZCT05PnNSFydKe4d/sIY7bCfWWFeT4qtLZlRyqLjFcqr+L WzVL8MgN37Kw2RFNJ9eRI/PoVERt/hXQAdOEgKO4K1fVyVl4IJNDmwgrsiZYj75O0dCP yr9AwrcwROzp72NosOIT0p4wT8qDNlMwX+6feztH+oUxcvnyBP74/0lZH+I38/JePdoq 8sd66Ng7EJGBDLxNxRmsug3/Tqbz+ES6RliKkzeyhL69g2VOaqMs9PYEsdmXyzeZr2M7 UAdA== X-Gm-Message-State: AKwxytdJLSl41yWUGU0dGLsWuJBkbR52ccuLNtxsl8Rls2vT5zA5exRE FBP5anM63pd5I7wW86GTVIGIkNnk4sPrVjTH3vBY4Q== X-Google-Smtp-Source: ACJfBouEuGf1eJTKlLR2TlYjLzL4CY7mXTtySxWh0ozPsUDUduVruvgedJ161owE8I52jpUEMlP3VFU3eGyDSwqOGfc= X-Received: by 10.55.170.194 with SMTP id t185mr7575469qke.278.1515517070566; Tue, 09 Jan 2018 08:57:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.148.18 with HTTP; Tue, 9 Jan 2018 08:57:50 -0800 (PST) In-Reply-To: <5a546fcab6ae2e0000bdb8e4@polymail.io> References: <5a546fcab6ae2e0000bdb8e4@polymail.io> From: "David G. Johnston" Date: Tue, 9 Jan 2018 09:57:50 -0700 Message-ID: Subject: Re: Advice on Contiguous IDs To: Brian McKiernan Cc: pgsql-docs@postgresql.org Content-Type: multipart/alternative; boundary="94eb2c05d15ea46b2e05625ad01b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --94eb2c05d15ea46b2e05625ad01b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jan 9, 2018 at 2:06 AM, Brian McKiernan < brian.mckiernan@firstcircle.com> wrote: > 1) What event would cause the CACHE clause in CREATE SEQUENCE to make an > out of sequence next number? > =E2=80=8BNone - it will always issue the next sequential value when asked. = But the transaction asking doesn't have to use the provided value as the PK for the table or, and even if it does, if the transaction fails and rolls-back the sequence value it received is discarded/lost.=E2=80=8B =E2=80=8B =E2=80=8BDavid J.=E2=80=8B =E2=80=8B --94eb2c05d15ea46b2e05625ad01b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Ja= n 9, 2018 at 2:06 AM, Brian McKiernan <brian.mckiernan@firstcircle.com> wrote:
1) What event would cause the=C2=A0CACHE clause in CREATE SEQUENCE to make an out of sequence next numbe= r?

=E2=80=8BNone - it will = always issue the next sequential value when asked.=C2=A0 But the transactio= n asking doesn't have to use the provided value as the PK for the table= or, and even if it does, if the transaction fails and rolls-back the seque= nce value it received is discarded/lost.=E2=80=8B
=E2=80=8B
=E2= =80=8BDavid J.=E2=80=8B
=E2=80=8B
--94eb2c05d15ea46b2e05625ad01b--