Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5Fhs-0005pa-CL for pgsql-committers@arkaria.postgresql.org; Tue, 24 May 2016 17:01:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b5Fhr-0007vg-Eo for pgsql-committers@arkaria.postgresql.org; Tue, 24 May 2016 17:01:23 +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 1b5Fhd-0007Tx-VC; Tue, 24 May 2016 17:01:10 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b5FhW-0006Ca-N2; Tue, 24 May 2016 17:01:09 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3741C20AF9; Tue, 24 May 2016 13:00:59 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 24 May 2016 13:00:59 -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=pHDEulj4o7/KZQR6ocM9WLgqz88=; b=Ynmww vRySiEZ4tdJpR9pVDLVgM9iMESDtu7A/cVfSja2UNkr5CyZMdYYReW7McH0tJMa2 bpjC7LvYkJKlic45MxsMDdWCCY68JOP4xjttogGKO6BQV42Q4ALnM2z1ZT1JXan4 lxzCclklv1BAR8MTTKVrw0ua0wQSEdOoZbFYVo= X-Sasl-enc: vM2zj5c+H12/ml64Id4rkluLykrNej0tkXFY9aK3e4dh 1464109258 Received: from intern.anarazel.de (somacentral.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id DB567CCD8E; Tue, 24 May 2016 13:00:58 -0400 (EDT) Date: Tue, 24 May 2016 10:00:58 -0700 From: Andres Freund To: Kevin Grittner Cc: Ants Aasma , Amit Kapila , Noah Misch , Robert Haas , Kevin Grittner , "pgsql-hackers@postgresql.org" , "pgsql-committers@postgresql.org" Subject: Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < Message-ID: <20160524170058.6fhenruilde4xza4@alap3.anarazel.de> References: <20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de> <171569342.34745.1461078735421@RIA> <20160506220728.bgyxet73t6s3hjiw@alap3.anarazel.de> <20160507004844.wbze4nhjqa67io2a@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-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 2016-05-24 11:24:44 -0500, Kevin Grittner wrote: > On Fri, May 6, 2016 at 8:28 PM, Kevin Grittner wrote: > > On Fri, May 6, 2016 at 7:48 PM, Andres Freund wrote: > > >> That comment reminds me of a question I had: Did you consider the effect > >> of this patch on analyze? It uses a snapshot, and by memory you've not > >> built in a defense against analyze being cancelled. > > > > Will need to check on that. > > With a 1min threshold, after loading a table "v" with a million > rows, beginning a repeatable read transaction on a different > connection and opening a cursor against that table, deleting almost > all rows on the original connection, and waiting a few minutes I > see this in the open transaction: > > test=# analyze verbose v; > INFO: analyzing "public.v" > INFO: "v": scanned 4425 of 4425 pages, containing 1999 live rows and > 0 dead rows; 1999 rows in sample, 1999 estimated total rows > ANALYZE > test=# select count(*) from v; > ERROR: snapshot too old > > Meanwhile, no errors appeared in the log from autovacuum. I'd guess that that problem could only be reproduced if autoanalyze takes longer than the timeout, and there's rows pruned after it has started? Analyze IIRC acquires a new snapshot when getting sample rows, so it'll not necessarily trigger in the above scenario, right? Is there anything preventing this from becoming a problem? Greetings, Andres Freund -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers