Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPw09-0002NV-QA for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2016 18:13:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bPw09-0006Ae-9O for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2016 18:13:45 +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 1bPvym-0004eh-EG for pgsql-hackers@postgresql.org; Wed, 20 Jul 2016 18:12:20 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bPvyj-0001Un-BE; Wed, 20 Jul 2016 18:12:19 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 79D702069D; Wed, 20 Jul 2016 14:12:15 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Wed, 20 Jul 2016 14:12:15 -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=o3PmpArf0hOr+OX4/rtj2f2P4wg=; b=XU98L oB5+2WjmYdGYsKrNqPQ6x3m64OVyCL7KZXAMLnBIrq9b4uA2Yz0raQrI9mBqi6L7 3ld2F0SgcWVNtuYGUI3SZZfvbqBGCPU57/47QHc2UelkRehW4gD8X7cwGgv7BsPR R6buXLo4i9Sdu3/jgn/w2jHYtQJ8Ih74LNJNlY= X-Sasl-enc: nnWDXRdUmDVHDrlsHZvIUy/IGhloPIa0hFRRV4rW03LY 1469038335 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id AC722F29F4; Wed, 20 Jul 2016 14:12:14 -0400 (EDT) Date: Wed, 20 Jul 2016 11:12:13 -0700 From: Andres Freund To: Robert Haas Cc: Amit Kapila , Kevin Grittner , Noah Misch , Alvaro Herrera , Ants Aasma , Kevin Grittner , "pgsql-hackers@postgresql.org" Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < Message-ID: <20160720181213.f4io7gc6lyc377sw@alap3.anarazel.de> References: <20160719021047.GB2027798@tornado.leadboat.com> <20160719233250.nir5vyvzef7m4e7z@alap3.anarazel.de> <1AB8F80A-D16E-4154-9497-98FBB164253D@anarazel.de> <20160720163033.4c4ku7orkzl7r4an@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 On 2016-07-20 13:59:32 -0400, Robert Haas wrote: > It's hard to believe that it's equally good to use the newest > registered snapshot (which is, I think, what you will often get from > GetActiveSnapshot()) and the oldest registered snapshot (which is what > you will get from pairingheap_first()). It seems to me that we need > to analyze what happens if we choose a snapshot that is older than the > one used to find the datum which contained the toast pointer, and > conversely what happens if we use a snapshot that is newer than the > one we used to find the toast pointer. Yea, the oldest seems better. > Here's an attempt: > > 1. If we pick a snapshot that is older than the one that found the > scan tuple, we might get a "snapshot too old" error that is not > strictly necessary. Right. Which still seems a lot better than essentially pessimizing vacuuming for toast tables considerably. > 2. If we pick a snapshot that is newer than the one that found the > scan tuple, then haven't we failed to fix the problem? I'm not so > sure about this direction, but if it's OK to test an arbitrarily new > snapshot, then I can't see why we need the test at all. I think some argument could be construed why it'd possibly be safe, but I feel a lot better with the other option. Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers