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.89) (envelope-from ) id 1hZMWW-0008Vk-2a for pgsql-general@arkaria.postgresql.org; Fri, 07 Jun 2019 21:35:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hZMWU-0002wr-Un for pgsql-general@arkaria.postgresql.org; Fri, 07 Jun 2019 21:35:42 +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 1hZMWU-0002u0-Jr for pgsql-general@lists.postgresql.org; Fri, 07 Jun 2019 21:35:42 +0000 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hZMWR-0003fw-49 for pgsql-general@lists.postgresql.org; Fri, 07 Jun 2019 21:35:42 +0000 Received: by mail-qk1-x744.google.com with SMTP id i125so2187723qkd.6 for ; Fri, 07 Jun 2019 14:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=CauuAgm2fJQPPuLTTMx3ONqRt2+wRaDkzOoXuKNL58k=; b=a9OliGEz8rf5F0PSKPyvyLvXCIce1SPrSx/Tosfx2OAbUnktjrYVBwP2Pc9JveyEw0 WQWAlVbi+/rNkc8IbK9blmUvLiFxGu09yhTLodbxNANzOL7T9eazBskf3iRceK83IZM8 mv1CYMKGlh7QL0FHGK4XIR7T/RQgVoUMSGS/feNIb/MxEbODtghUt9k7AeODVjQvFjyo ytGldtyubiAXS7kTUVDYwd0U0KePza/U6CVXTKkXaMMNlE9Vjthrx737c55h3PaH4Bsb neWDZqzhLX58fN2hr7+EZa+GkINXBy+GIXRSp02pz/TeqQoXupUt9opetIHp7qdtnBvE 5+hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=CauuAgm2fJQPPuLTTMx3ONqRt2+wRaDkzOoXuKNL58k=; b=j7I3CsYIA79/j2bqxkJoEZIHbdEr8k3ZWrfFyS5fMwgww+adYSUyNrAEmUiBx+M2rY uds3qx+sYnKWAvRn8WmCeWhFSRNch7Am6PEj+Q/TBeYNO4Tyol3fOcb4PL5t33zLSkO4 8y4cOUpIkX4+oqS0a4mU0uQdlocLdpYMyKSiae4z4KO69kSBA76rTcZZ3LXxaIg+onCB bXKVYPJ+MCJ803ZAzq71gglJaHmD/NXHN+34tQWEKdqcV0Ub4+1Cew8GaHr5Xte3mVV+ tE2pqkCVUylX8+pvr/4apLn0nJZGaN/XQfqjVaBrpGrzLdGeflMHi1w8ZUNUwwk6JVNL q/jA== X-Gm-Message-State: APjAAAXMJJGEO9wMm7aeSp5jtv6demvwWCYidZwd4YdoXtC+RL2RBcfV AXzKGqHuEz+oLl0zH5Cr7PYDqg== X-Google-Smtp-Source: APXvYqz8KI+sO/+UKwDSMs7YHWJhrJCimkpfMievVG9Ws9YGQUACeQcVJ7+nGK9mot9/7JzH78hS7g== X-Received: by 2002:a05:620a:1206:: with SMTP id u6mr44951761qkj.88.1559943336233; Fri, 07 Jun 2019 14:35:36 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([177.154.145.98]) by smtp.gmail.com with ESMTPSA id 2sm1933717qts.61.2019.06.07.14.35.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 14:35:35 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id C174A12097D; Fri, 7 Jun 2019 17:35:32 -0400 (-04) Date: Fri, 7 Jun 2019 17:35:32 -0400 From: Alvaro Herrera To: Peter Geoghegan Cc: David Rowley , "Alex V." , pgsql-general , tgl Subject: Re: Table partition with primary key in 11.3 Message-ID: <20190607213532.GA26907@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jun-07, Peter Geoghegan wrote: > On Fri, Jun 7, 2019 at 1:22 PM Alvaro Herrera wrote: > > Because you can't rely on that exclusively, and you want to reuse the > > partition ID eventually, you still need a cleanup process that removes > > those remaining index entries. This cleanup process is a background > > process, so it doesn't affect latency. I think it's not a good idea to > > add latency to clients in order to optimize a background process. > > Ordinarily I would agree, but we're talking about something that takes > place at the point that we're just about to split the page, that will > probably make the page split unnecessary when we can reclaim as few as > one or two tuples. A page split is already a very expensive thing by > any measure, and something that can rarely be "undone", so avoiding > them entirely is very compelling. Sorry, I confused your argumentation with mine. I agree that removing entries to try and prevent a page split is worth doing. > > This way, when a partition is dropped, we have to take the time to scan > > all global indexes; when they've been scanned we can remove the catalog > > entry, and at that point the partition ID becomes available to future > > partitions. > > It seems worth recycling partition IDs, but it should be possible to > delay that for a very long time if necessary. Ideally, users wouldn't > have to bother with it when they have really huge global indexes. I envision this happening automatically -- you drop the partition, a persistent work item is registered, autovacuum takes care of it whenever. The user doesn't have to do anything about it. > You don't have to be Claude Shannon to realize that it's kind of silly > to reserve 16 bits for the offset number component of a > TID/ItemPointer. We need to continue to support offset numbers that go > that high, but the implementation would optimize for the common case > where offset numbers are less than 512 (or maybe less than 1024). (In many actual cases offset numbers require less than 7 bits in typical pages, even). -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services