Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDcDg-0006Be-Sy for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Jun 2016 18:40:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bDcDg-00033N-AF for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Jun 2016 18:40: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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bDcDe-0002yB-3N; Thu, 16 Jun 2016 18:40:46 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bDcDa-0006vu-QE; Thu, 16 Jun 2016 18:40:45 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 87EE9205A5; Thu, 16 Jun 2016 14:40:41 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Thu, 16 Jun 2016 14:40:41 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=hz5pHgF7v8cR9nifVl/+Iz5z+w4=; b=cC78k LxxGpQ5h3PZgFc9Rz9zyrulo559JNQdCcTXxbkvGKuicjXmA2fjriwkDy0NoE9SF XaCZSDwJRcTTytO/SiXLQw2pxVct2B63jZVCHzhRi4GiHZxif6ceVE4xiUN1SNe1 dRpi1m0JzgY+mBYjcTvhSLRQSmXgbOWtnqOJvo= X-Sasl-enc: Vh6XNHi+2ru4HLBeSy2zbq8IofvkKhjgiGqqdYn2Zcc9 1466102440 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id A0B63CCDA6; Thu, 16 Jun 2016 14:40:40 -0400 (EDT) Date: Thu, 16 Jun 2016 11:40:39 -0700 From: Andres Freund To: Kevin Grittner Cc: Robert Haas , Alvaro Herrera , Ants Aasma , Amit Kapila , Noah Misch , Kevin Grittner , "pgsql-hackers@postgresql.org" , "pgsql-committers@postgresql.org" Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < Message-ID: <20160616184039.cevbwbtge6miafjs@alap3.anarazel.de> References: <20160615223440.omhksf4senwtfc6q@alap3.anarazel.de> <20160616015730.rtozaq5mmlhci6xy@alap3.anarazel.de> <20160616153745.upxilwj3spbi43dj@alap3.anarazel.de> <20160616161426.bapgkbh762ktzyhk@alap3.anarazel.de> <20160616165440.pla4q3gbozyciuyo@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi, On 2016-06-16 13:19:13 -0500, Kevin Grittner wrote: > On Thu, Jun 16, 2016 at 11:54 AM, Andres Freund wrote: > > On 2016-06-16 12:43:34 -0400, Robert Haas wrote: > > >> The root of my confusion is: if we prune a tuple, we'll bump the page > >> LSN, so any session that is still referencing that tuple will error > >> out as soon as it touches the page on which that tuple used to exist. > > > > Right. On the main table. But we don't peform that check on the toast > > table/pages. So if we prune toast tuples, which are still referenced by > > (unvacuumed) main relation, we can get into trouble. > > I thought that we should never be using visibility information from > the toast table; that the visibility information in the heap should > control. We use visibility information for vacuuming, toast vacuum puts toast chunk tuples through HeapTupleSatisfiesVacuum(), just like for normal tuples. Otherwise we'd have to collect dead toast tuples during the normal vacuum, and then do explicit vacuums for those. That'd end up being pretty expensive. > If that's the case, how would we prune toast rows without > pruning the heap? I'm not sure what you mean? We prune toast tuples by checking xmin/xmax, and then comparing with OldestXmin. Without STO that's safe, because we know nobody could lookup up those toast tuples. > You pointed out that the *reverse* case has an > option bit -- if that is ever set there could be toasted values > which would not have a row. We vacuum toast tables without the main table, by simply calling vacuum() on the toast relation. So you can get the case that only the normal relation is vacuumed *or* that only the toast relation is vacuumed. > Do they still have a line pointer in the heap, like "dead" index > entries? You can have non-pruned toast tuples, where any evidence of the referencing main-heap tuple is gone. > How are they cleaned up in current production versions? There's simply no interlock except OldestXmin preveting referenced toast tuples to be vacuumed, as long as any alive snapshot can read them. Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers