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 1jFjTg-0006on-8h for pgsql-general@arkaria.postgresql.org; Sat, 21 Mar 2020 19:08:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jFjTf-0007HW-1l for pgsql-general@arkaria.postgresql.org; Sat, 21 Mar 2020 19:08:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jFjTe-0007GZ-KS for pgsql-general@lists.postgresql.org; Sat, 21 Mar 2020 19:08:10 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jFjTV-0006zX-2J for pgsql-general@lists.postgresql.org; Sat, 21 Mar 2020 19:08:08 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id C6F0A298E; Sat, 21 Mar 2020 20:07:58 +0100 (CET) Date: Sat, 21 Mar 2020 20:07:58 +0100 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Could postgres12 support millions of sequences? (like 10 million) Message-ID: <20200321190758.GA5473@hjp.at> References: <20200320225842.GA18976@hjp.at> <0D8F2D62-C0E4-4D6C-B77C-9A2FEB78898C@gmail.com> <20200320232929.GA22868@hjp.at> <03223774-abab-f2c8-9f7c-824eb545a401@aklaver.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: <03223774-abab-f2c8-9f7c-824eb545a401@aklaver.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-03-20 17:53:11 -0700, Adrian Klaver wrote: > On 3/20/20 4:29 PM, Peter J. Holzer wrote: > > On 2020-03-20 17:11:42 -0600, Rob Sargent wrote: > > > On Mar 20, 2020, at 4:59 PM, Peter J. Holzer wrote: > > > > On 2020-03-19 16:48:19 -0700, David G. Johnston wrote: > > > > > First, it sounds like you care about there being no gaps in the r= ecords you end > > > > > up saving. If that is the case then sequences will not work for = you. > > > >=20 > > > > I think (but I would love to be proven wrong), that *nothing* will = work > > > > reliably, if > > > >=20 > > > > 1) you need gapless numbers which are strictly allocated in sequence > > > > 2) you have transactions > > > > 3) you don't want to block [...] > > Yes. This wasn't a response to the OP's requirements, but to David's > > (rather knee-jerk, IMHO) "don't use sequences" response. Very often the > > requirements which would preclude sequences also preclude any other > > solution. >=20 > I don't see a knee-jerk reaction in this: >=20 > https://www.postgresql.org/message-id/CAKFQuwZ%3D%3Dri5_m2geFA-GPOdfnVggm= JRu3zEi%2B1EwJdJA%3D9AeQ%40mail.gmail.com >=20 > The response was if you cared about gaps(not something the OP had specifi= ed > at that point) then a sequence would not work. And I think that "care about gaps -> sequence doesn't work" is a knee-jerk reaction. It's similar to "can't parse HTML with regexps". True in the general case, and therefore people tend to blurt it out every time the topic comes up. But not necessarily true in specific cases. As I wrote above, there is no perfect solution - so you have to think about the actual requirements and the consequences of various solutions - and maybe using a sequence is the best (or least bad) solution. hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --a8Wt8u1KmwUX3Y2C Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl52ZgkACgkQ8g5IURL+ KF3kBRAAl6JqpxNeYS4w5m8X7gruWX3E//ZJdFOixyWCrcbW2a3cfHPniXifWwEa Kj1iQqZuk+QsC66vcoIRZUGKsQRbknGCIoUcNJs6ccwJVxfR0GFBgGQVgTTK7Fxp ZLPmirGbZSV0TGITQhEo24Qkli78p9ImZKxyc3qq0w+zK8WRSXyAWfiZdvBlGmQP lT7isHpwlRhezjiU1rYSmmYoglJ0kP6Tu+Y/COaLUm/d7r8MTK7b/yhuvO1FvMMc kOWVSxkX8w7ybDDhzudb77ZxyR1WUjwjhw9wamQ0LUvZpeqtcHuWZg7PLTYiDbJ2 3Yhxg3dnMjcKwKLn9L9i9+9HGf41yceDRR8McSOg9olgH6fSzbm8/PGByWnMKkJ7 w67KO+HpS+Pa8dQ3AHK8aAQ2mTxV4G5jN87x3cQanzU4qVW6L/HppJ7UIX8cy0D2 astFPmVT8wbKunHu4lua1k4zTDBOjK/NFqAIeHkwMFW+TCkDG4n/kBSpSvvKZhLj VmR/Po1S8vSwMmXlsvm4sRPtF6qx8Jm9WNjIpZRy4l4Mb/54S8SZLH5PegZz5RqJ HHkV6brFZrUjtKVezqTQt+CyyJM9CHjntOyBpQn3meWsSqsaNJWKJSlDvL9iToAd zeWO23A4qEQwNTs0p/O5AQdAMnPEK9Dbo9n1Pqvp8qnh+io7qfE= =2EiZ -----END PGP SIGNATURE----- --a8Wt8u1KmwUX3Y2C--