Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5Jbd-0005kO-FU for pgsql-committers@arkaria.postgresql.org; Tue, 24 May 2016 21:11:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b5Jbd-0007AX-2G for pgsql-committers@arkaria.postgresql.org; Tue, 24 May 2016 21:11:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b5JbP-0006iJ-Q3; Tue, 24 May 2016 21:10:59 +0000 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1b5JbI-0001Hd-W4; Tue, 24 May 2016 21:10:58 +0000 Received: by mail-qk0-x243.google.com with SMTP id z80so3215493qkb.2; Tue, 24 May 2016 14:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=gK7stdkMk9B/Xo+hj28msaky3DLju+ZNVG4vkwak2eI=; b=QxL4XKY4KCdS4iN/wOeky+B4ChlIqgmmmRtUe6W1W1bo+mihr4swuWJnSTpffvP64e VX+nhxbHAZi9LIG7AZuPslyl6CHnp6F2WoEn1Iq4lWtD0PORsfCmNTZYkwfuWddZFhQ1 pnj8a77BEAMvlRfev7/R8UvG39d/zUV3j+wusyLb50MaCV0jBEq9iq7TyUnRIsbhBqLa UArXcU+YnPQyX8xogdawsUziLQV0ClJTlJqYl8hdnicd4h3yiww/+1hnBVTnNjCHs7Ww 8pIIl6Jy9cEzLbcUuxVsfFXUUVlbLCFYtaYTyj9z1teRWZEPk40Xyz0op8OMcirsP0KB mf0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=gK7stdkMk9B/Xo+hj28msaky3DLju+ZNVG4vkwak2eI=; b=SLO+32XxgvfT+XXhDaKoC9ITcxzo20aQ83dyOoe5mvFsGYjjSap3nmrd30CWlEcoh3 Oiz/woeceGYPtav5Tj27/LlIe04YtwwXYROfhmX5PKAMtGtEHJnokyFKsjUkbrou7bZI sBM7Z12kpod7fMssxQZyjQQDbId8J3dOe4XryfR6GhLW0knxjqo6GDo9tO7gl9y06vX8 k4OznIQNIMdQx5vgBtD1zsETGaMkf6na3BsDyybggbZKKdCNXplqS7Vd2ibNKoOeFGQo OYWKclrgtnPbp5RnACFVJYgF5osbmO37MmjqHpM425TLhQwDZP2T9l2/UStvaktd4c/M IR/A== X-Gm-Message-State: ALyK8tKxMomG3VjquOuWB6PjQ6aODrWUjDqhI1bYd6HrNphMU90dO0gs64g9kZaGooJ7yDDC0laO+p7Brub6+A== MIME-Version: 1.0 X-Received: by 10.237.47.166 with SMTP id m35mr251741qtd.29.1464124251992; Tue, 24 May 2016 14:10:51 -0700 (PDT) Received: by 10.237.40.164 with HTTP; Tue, 24 May 2016 14:10:51 -0700 (PDT) In-Reply-To: References: <20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de> <171569342.34745.1461078735421@RIA> <20160506220728.bgyxet73t6s3hjiw@alap3.anarazel.de> <20160507004844.wbze4nhjqa67io2a@alap3.anarazel.de> <20160524170058.6fhenruilde4xza4@alap3.anarazel.de> Date: Tue, 24 May 2016 17:10:51 -0400 Message-ID: Subject: Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < From: Robert Haas To: Kevin Grittner Cc: Andres Freund , Ants Aasma , Amit Kapila , Noah Misch , Kevin Grittner , "pgsql-hackers@postgresql.org" , "pgsql-committers@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) 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 Tue, May 24, 2016 at 3:48 PM, Kevin Grittner wrote: > On Tue, May 24, 2016 at 12:00 PM, Andres Freund wrote: >> 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. > > The primary defense is not considering a cancellation except in 30 > of the 500 places a page is used. None of those 30 are, as far as > I can see (upon review in response to your question), used in the > analyze process. It's not obvious to me how this is supposed to work. If ANALYZE's snapshot is subject to being ignored for xmin purposes because of snapshot_too_old, then I would think it would need to consider cancelling itself if it reads a page with possibly-removed data, just like in any other case. It seems that we might not actually need a snapshot set for ANALYZE in all cases, because the comments say: /* functions in indexes may want a snapshot set */ PushActiveSnapshot(GetTransactionSnapshot()); If we can get away with it, it would be a rather large win to only set a snapshot when the table has an expression index. For purposes of "snapshot too old", though, it will be important that a function in an index which tries to read data from some other table which has been pruned cancels itself when necessary. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers