Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDGMO-0006Se-0Z for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jun 2016 19:20:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bDGMN-0004Bs-Jo for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jun 2016 19:20:19 +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 1bDGMM-00048W-FC; Wed, 15 Jun 2016 19:20:18 +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 1bDGMJ-0001i7-Bv; Wed, 15 Jun 2016 19:20:17 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CA94821E25; Wed, 15 Jun 2016 15:20:13 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Wed, 15 Jun 2016 15:20:14 -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=91NnS2jbYKkTop9IPlXI1ofb9IA=; b=Iskwn sdV9s+B/W1BncUtbMTex+GqjnVeVNLLViZKsPqc3O9x+/A1h/rsW/8JqbhH7m++K 4RqVF9TTz3kXfVaF/VSwZuBZtHxer6jmOgiPylMlT3NqfaH+kPGuDZdvjL3worGZ tRt3IAD4d/LoJnDFlS9MSPvWRHN08KFEuBu1ro= X-Sasl-enc: oPp5WDXLridYH7e9oaFkcOpJ/YkE4ZHtX0Yrv1V+xOtU 1466018413 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id 430ADF29FC; Wed, 15 Jun 2016 15:20:13 -0400 (EDT) Date: Wed, 15 Jun 2016 12:20:11 -0700 From: Andres Freund To: Robert Haas Cc: Alvaro Herrera , Kevin Grittner , 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: <20160615192011.eicg7hwkndyx2cmo@alap3.anarazel.de> References: <20160615184537.GA20738@alvherre.pgsql> 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 On 2016-06-15 14:50:46 -0400, Robert Haas wrote: > On Wed, Jun 15, 2016 at 2:45 PM, Alvaro Herrera > wrote: > > Robert Haas wrote: > >> On Wed, Jun 15, 2016 at 1:44 PM, Kevin Grittner > >> wrote: > >> > The test I showed creates a situation which (to ANALYZE) is > >> > identical to what you describe -- ANALYZE sees a page with an LSN > >> > recent enough that it could have been (and actually has been) > >> > pruned. Why would it be better for the ANALYZE to fail than to > >> > complete? > >> > >> As I understand it, the reason we need to sometimes give "ERROR: > >> snapshot too old" after early pruning is because we might otherwise > >> give the wrong answer. > > > > So what constitutes "the wrong answer"? A regular transaction reading a > > page and not finding a tuple that should have been there but was > > removed, is a serious problem and should be aborted. For ANALYZE it may > > not matter a great deal. Some very old tuple that might have been > > chosen for the sample is not there; a different tuple is chosen instead, > > so the stats might be slightly difference. No big deal. > > > > Maybe it is possible to get into trouble if you're taking a sample for > > an expression index. > > The expression index case is the one to worry about; if there is a > problem, that's where it is. What bothers me is that a function used > in an expression index could do anything at all - it can read any > table in the database. Isn't that also a problem around fetching toast tuples? As we don't TestForOldSnapshot_impl() for toast, We might fetch a toast tuple which since have been re-purposed for a datum of a different type. Which can have arbitrarily bad consequences afaics. Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers