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 1jGAcd-0002Io-Jx for pgsql-general@arkaria.postgresql.org; Mon, 23 Mar 2020 00:07:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGAcZ-0002cA-77 for pgsql-general@arkaria.postgresql.org; Mon, 23 Mar 2020 00:07: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 1jGAcW-0002bv-6Z for pgsql-general@lists.postgresql.org; Mon, 23 Mar 2020 00:07:10 +0000 Received: from [66.111.4.29] (helo=out5-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGAcQ-0003F6-Nt for pgsql-general@lists.postgresql.org; Mon, 23 Mar 2020 00:07:06 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B98C85C01AE; Sun, 22 Mar 2020 20:06:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 22 Mar 2020 20:06:51 -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=P 9aZciPcDhwxK+kVxGYSF7b41JuvLfSzVkw8xOztwtA=; b=upUU/OdnhnPaLsgNc sLF7BDvXlzG27XsVhKlkckaCJb44OPH/HI3J13HOLGyjd+t6tncOSkIU5B9Zjh3q VfTMJXeapoHGOEIO2cNvhb6Vxi8iZG76HXF+WyAiFBMTeHxhQ1fTBlG2vN+EKN+t 5DX80j2yvFGMH4iS+dqZ+DkrFDF7tGWSOhjXwaBS0Aq6ceuKqJqiGW+6bzJComwn nMKnj/uoGSqe1XkOgWof2Z1apRAc6n3WsX2dpSQt5MqymZvyR5RbUC9XpY6ACwtw jgn1K/QqECkWawxQ8MudX5xhvCWIgJisKbet/wy1h7iI+j32LhTSbUy1cbhXPkpo KLJzg== 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=P9aZciPcDhwxK+kVxGYSF7b41JuvLfSzVkw8xOztw tA=; b=g4HsQRYxhKCb8H55DJMAaTPD0/m5Eu8SlPbxxxeHrqtdQwo5UorZKQh+Z /vqrDgZtl6JLXnlc2Uk5+tU5n+yKgH1gjn3mcLtWlXazW75bX12/CpWQqGBQu/R3 2I9gskj0qW3DOwswIhu7DKSsgTLIeQlzus+AO5vn/tREndhNeb/B3hu0pXJUh9ZX PuHE9HNO2DZreIAjAt8QeArBprVPotzoIRvYTxOmLHWIz70NV6bfTV93tIAy0GlC DJUr3I2s+S+QSl34jADib4/nXofz36Zwc/pfTqGKOQrLPZ/F0db7HHizgntCy3k8 f/N6m92THMYhV8dGO5dOhmHWB6wxw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudegjedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphepjedurddvuddvrdduvdelrdduleefnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklh grvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id C24E83062A92; Sun, 22 Mar 2020 20:06:50 -0400 (EDT) Subject: Re: Could postgres12 support millions of sequences? (like 10 million) To: pabloa98 Cc: Rob Sargent , "Peter J. Holzer" , "pgsql-generallists.postgresql.org" References: <2c994f4f-6627-1c4d-fac5-d3c442d197e9@aklaver.com> <7B1364EB-7DE5-48E7-A85D-F849EAE569F7@gmail.com> <73f5c4ac-1bd3-d517-f507-74d042ae1365@aklaver.com> From: Adrian Klaver Message-ID: <28a605f9-ec38-855b-f258-48bcae367ed2@aklaver.com> Date: Sun, 22 Mar 2020 17:06:49 -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 X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.29 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/22/20 2:53 PM, pabloa98 wrote: > > So the question may actually be: > > How do we improve our locking code, so we don't have to spawn millions > of sequences? > > What is the locking method you are using? > > > I am not using locking with the million sequence solution. I do not want > something that locks because the problems described below > > I prefer the solution generates a gap (skip a couple of numbers) and not > using locks. > > > > > The lock part is because we solved a similar problem with a > counter by > > row locking the counter and increasing it in another part of the > > database. The result is that all the queries using that table are > queued > > by pair (group, element) that is not that bad because we are not > > inserting thousands of rows by second. Still is killing cluster > > performance (but performance is still OK from the business point of > > view). The problem using locks is that they are too sensitive to > > developer errors and bugs. Sometimes connected clients aborts and > the > > connection is returned to the pool with the lock active until the > > connection is closed or someone unlocks the row. I would prefer > to have > > something more resilient to developers/programming errors, if > possible. > > > > Now I read this paragraph, I realize I was not clear enough. > I am saying we do not want to use locks because of all the problems > described. And what I was asking is what locking where you doing? And it might be better to ask the list how to solve those problems, then to create a whole new set of problems by using millions of sequences. -- Adrian Klaver adrian.klaver@aklaver.com