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 1jFng4-0001SN-Tt for pgsql-general@arkaria.postgresql.org; Sat, 21 Mar 2020 23:37:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jFng3-00052g-1M for pgsql-general@arkaria.postgresql.org; Sat, 21 Mar 2020 23:37:15 +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 1jFng1-00052X-7M for pgsql-general@lists.postgresql.org; Sat, 21 Mar 2020 23:37:14 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jFnfq-0005kH-DA for pgsql-general@lists.postgresql.org; Sat, 21 Mar 2020 23:37:10 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id ECC9F405; Sat, 21 Mar 2020 19:36:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 21 Mar 2020 19:36:59 -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=Y p/pnsAmqgZkMoJoTNaDsAnKhMLj11pAH8AS82YkL3E=; b=ULt4zYAdUPljsinf1 +ew47t7KFTFCvrwBH2fGCH1NmtnWdfEM5aPxoEt6pgittDy8QBtope35QzWiFTYw 3C+IFw2a4hpmykPxxA3zRdHLjSifugfrQEE88W181moBPNdWYhrkYuaOo1E6eB3B nvYiFRJPRC3wM8lgkZ/0OuasLM9gdirTCYngcvlOqNh+ljgf0XTS9V51L/99thWZ DOTyJ9mkAlB7OkkwLKbAw4vopLOuR/QRsI82IxnuiZK9h8z7/NoqSZcTogY7aPwW ppvMZNMgKegaS9TMoEVcYJ/1CZEyYGilWhUiUoFvU/4av8PiR6Zr/qoduvoI2rdo VI3xg== 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=Yp/pnsAmqgZkMoJoTNaDsAnKhMLj11pAH8AS82YkL 3E=; b=LVjz1pvA6P88sC+YAxwM6IyyKGeQME5lFKYcz4+a4c64+h3N3bFJzj2WI kZJ/n7piCbHLuBMdxeBD1BS6QGHazRWbaLWam/lRNQUZ60WXCi4W06OMj8KfQh8y JGUqw+NFrxYJsgNMq5GvVdpLyLDksmyh2u6kOxXpXqltjQArjJ93CGbM2DsoaXHs oOYC5uvGlcw0DIHdUW90sahTMkQtL9TRAV3/XowO+XJjNKtA8gRDLUUgoOIDCyCD t+DIkCvF/5yfTXRV666N59+28yz4a/GrDqU8BBAPq7UcLQyc1p5izU3eqs6TwSou V19PjdSknsUa3ZSCTppxG9CmhE1Yg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudeggedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi 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 46343328005A; Sat, 21 Mar 2020 19:36:57 -0400 (EDT) Subject: Re: Could postgres12 support millions of sequences? (like 10 million) To: pabloa98 , "Peter J. Holzer" Cc: "pgsql-generallists.postgresql.org" References: <20200320225842.GA18976@hjp.at> <0D8F2D62-C0E4-4D6C-B77C-9A2FEB78898C@gmail.com> <20200320232929.GA22868@hjp.at> <03223774-abab-f2c8-9f7c-824eb545a401@aklaver.com> <20200321190758.GA5473@hjp.at> From: Adrian Klaver Message-ID: <9ef7e0ea-1314-290a-d0ee-cbcd095e8e41@aklaver.com> Date: Sat, 21 Mar 2020 16:36:56 -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: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/21/20 1:45 PM, pabloa98 wrote: > > > On Sat, Mar 21, 2020 at 12:08 PM Peter J. Holzer > wrote: > > > > 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. > > > OK. In that case, I will proceed with the millions of sequences. We will > see. > > Anyway, It will be awesome if we have a sequence data type in a future > version of postgresql. They will solve a lot of problems similar to this > one. Actually there are already two: https://www.postgresql.org/docs/12/datatype-numeric.html#DATATYPE-SERIAL https://www.postgresql.org/docs/12/sql-createtable.html " GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) ] This clause creates the column as an identity column. It will have an implicit sequence attached to it and the column in new rows will automatically have values from the sequence assigned to it. " What you want is a built in method to pull from different sequences depending on the value of another column or values from multiple columns in the same table. > > Pablo > -- Adrian Klaver adrian.klaver@aklaver.com