Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jF91g-0007oY-As for pgsql-general@arkaria.postgresql.org; Fri, 20 Mar 2020 04:12:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jF91c-0006Dv-W7 for pgsql-general@arkaria.postgresql.org; Fri, 20 Mar 2020 04:12:48 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1jF91a-0006Cr-Ry for pgsql-general@lists.postgresql.org; Fri, 20 Mar 2020 04:12:48 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jF91Q-00074a-El for pgsql-general@lists.postgresql.org; Fri, 20 Mar 2020 04:12:46 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id ACFA05C01D7; Fri, 20 Mar 2020 00:12:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 20 Mar 2020 00:12:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=m 8VoKMqL50RZWYHCuekd3A0ZjmWwFiMRhYftM170gtA=; b=X3MKP5Sd84AL5OalK RGKbXVn5EthtMb5sLPomvMZ5WSS1PxUMTSkavqEEv96vQMH5mHxI7wwq7HnHat0Y KiJTBlDKq4T/coF+l5kaz55ucFvHLZhvNovOkp/+FOgS1KWEwYRNuR/JP19iqsih 3STHqbIRzsP5SZObBKfa4QO5Bw3lyo+d9OQYA/Tnji1PCH9E05qFgcYDB/tMDnvK P7Cbt+ZUyOq8gUifSanj8e5KWpUlB4DZt77nPwv0oO1zxRAugqidpgrBkV4nobCW x/uj45x+nHt6C2XGLt6pq8UtCq6207n072H4WX8s99w3osKknsPwbJYmvjpwvp3n nJ+zQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=m8VoKMqL50RZWYHCuekd3A0ZjmWwFiMRhYftM170g tA=; b=C+Hv1dTJc04re1Q78oz78MUs/w2smkl2ZQ/27j24a4RVupgFZyIbPOyrj ajqwH1V+Nw/gNOW8kldwiEC4ohX0WLKczH+B7O5ma/bVJYKb4Z2I0ikxaL4uVn9q mxbge9bUXgrs2V/fPJ2JjhSbOF7+2RmXA9fYQ3yUceSetZBh8rgjAK+v9DVzvARb HQ5Z6jASVZlOG9xN+QrEKTL51KnFwbV+xGV8Kt+sc5HsdOvnLV+4bIS0s4hw18vX JNKhPNdXxmbz4CLwYM2WNkwuDBVTRU5HhMp/nMLgXWGM33BoJPRsONvUeY2s6QeF zMZqlOtN/w1rKIWC/SDX9FEfttl8A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudegtddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeejuddrvddu vddruddvledrudelfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id AC535328005D; Fri, 20 Mar 2020 00:12:31 -0400 (EDT) Subject: Re: Could postgres12 support millions of sequences? (like 10 million) To: Michael Lewis , "David G. Johnston" Cc: pabloa98 , Rob Sargent , "pgsql-generallists.postgresql.org" References: <7CF69CD4-AE4A-4C2B-9621-4462B4AE1726@gmail.com> From: Adrian Klaver Message-ID: Date: Thu, 19 Mar 2020 21:12:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/19/20 7:38 PM, Michael Lewis wrote: > > > On Thu, Mar 19, 2020, 5:48 PM David G. Johnston > > wrote: > > However, one other consideration with sequences: do you care that > PostgreSQL will cache/pin (i.e., no release) every single sequence > you touch for the lifetime of the session? (I do not think DISCARD > matters here but I'm just guessing) > > > > Would you expand on this point or is there someplace specific in the > documentation on this? > See the section starting here: https://www.postgresql.org/docs/12/sql-createsequence.html Notes "Unexpected results might be obtained if a cache setting greater than one is used for a sequence object that will be used concurrently by multiple sessions. Each session will allocate and cache successive sequence values during one access to the sequence object and increase the sequence object's last_value accordingly. Then, the next cache-1 uses of nextval within that session simply return the preallocated values without touching the sequence object. So, any numbers allocated but not used within a session will be lost when that session ends, resulting in “holes” in the sequence. ... " -- Adrian Klaver adrian.klaver@aklaver.com