Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gZGpo-00051V-Ao for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Dec 2018 14:59:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gZGpl-0001BC-GG for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Dec 2018 14:58:57 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gZGpl-0001B5-9B for pgsql-hackers@lists.postgresql.org; Tue, 18 Dec 2018 14:58:57 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gZGpi-0003Ly-8i for pgsql-hackers@postgresql.org; Tue, 18 Dec 2018 14:58:56 +0000 Received: by mail-wr1-x42e.google.com with SMTP id r10so16200426wrs.10 for ; Tue, 18 Dec 2018 06:58:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mjZZRYEAjYC/HxE4KYtuSNf8FRMq82ergNJuAH6iYN4=; b=JMJqt6HzC0MoWQuLwboHmJhXvOn2YL/Zl9BCXZr+xNBN5N7DLNpOeQRs94X9i5+s0H WRDH4qNvi4Dgtt/qZ4OZGl1t4sOY5sPqQewPenvlu5bnnEuoqq3bRCpiMwK+h1bP1Asw ZC4AalOQni6zrMU39lh3s+sIMTV0mkS8LlIM8pX8/nCda50xIiZ5rh9e12l+3Lwkh6I0 b+BJAR+Cm7G3Ye/wQrPKEPkU0gjpW1om8mV+aHrj12FM4YXkO8e+2bGO61ZSEWp++1AI 5zcAi2E114iLv8fIpFRsx1hDSF60DrdBpU3su9ZUgZGhhNZjNyuXt+SZ+oxwVTwTdk/9 wTqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mjZZRYEAjYC/HxE4KYtuSNf8FRMq82ergNJuAH6iYN4=; b=XWmVWSS06+3YfpTF3oWlIyVszTEGNzIOxyp4UObRSEPHnYBRVFcLBoR4M3NmfBJJXe UX9Id7YgI+7Aw15JUFwum8yer7jVmanO1p8Si/K60AXF/DcSTaFNlf4zvODLzmY4tOJZ GWTV7EE03Tg+iAASsPvAigSyJuKrYTGMS581o791diigVJAnr0xmJCTUU/L0e89elMZz z/mLAbcANm5K6myX85XEdX3XdYPoHkaZqlxcqCk2PjTotmSI8K0MSX8kZfypNgbcmUes +UHWx9Cnt9sPyNrOGtBVpN6pDR02Yv88EZMaR+xFS4qyyPgjen8YAyrhMRcYts8tccHG fTig== X-Gm-Message-State: AA+aEWZHuXFyUqlOy2Rc0WzjkU1AalYgjyqZL18tCxf5bdJpaRrjeNKb blojhfDw9djqkq8P0USlH5ju0bXYruskEKnPpAK6vtsKy1AqGzxlxmJHHXrbrLNvFNZTHAuZlCA UQsslOEAvPWQmnFQJ2L2XK3FFgW4JqbdVKG8U4oD+GEaW/5ZEYWoNrpXQLKjIMaTMvDqiCq6UQG VC7C86ekujgVn6rg== X-Google-Smtp-Source: AFSGD/VwEGXEWVvSjFOd5gAja2NiwpE5tl0IkiwazkU8SDwG43wxDZga2iICpKjI3iBwR18X0KwN9A== X-Received: by 2002:a5d:4dc8:: with SMTP id f8mr15446877wru.45.1545145132520; Tue, 18 Dec 2018 06:58:52 -0800 (PST) Received: from [10.137.2.21] (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id o4sm3461304wrq.66.2018.12.18.06.58.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 06:58:51 -0800 (PST) Subject: Re: explain plans with information about (modified) gucs To: Andres Freund Cc: Tom Lane , legrand legrand , pgsql-hackers@postgresql.org References: <10561.1544800904@sss.pgh.pa.us> <631ae5c8-5581-6c5e-382c-2dcdb2e5c956@2ndquadrant.com> <1545083780942-0.post@n3.nabble.com> <1edcee55-ea96-d123-199d-4c5f1fc5003b@2ndquadrant.com> <24065.1545085015@sss.pgh.pa.us> <2c09fe19-e4a0-ea66-5a7f-e69d46420e28@2ndquadrant.com> <20181217234353.fde7vityxvoullil@alap3.anarazel.de> From: Tomas Vondra Message-ID: Date: Tue, 18 Dec 2018 15:58:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20181217234353.fde7vityxvoullil@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/18/18 12:43 AM, Andres Freund wrote: > Hi, > > On 2018-12-18 00:38:16 +0100, Tomas Vondra wrote: >> On 12/17/18 11:16 PM, Tom Lane wrote: >>> Tomas Vondra writes: >>>> Yeah, I've been thinking about that too. Currently it gets filtered out >>>> because it's in the CLIENT_CONN_STATEMENT group, but the code only >>>> includes QUERY_TUNING_*. >>>> But we don't want to include everything from CLIENT_CONN_STATEMENT, >>>> because that would include various kinds of timeouts, vacuuming >>>> parameters, etc. >>>> And the same issue applies to work_mem, which is in RESOURCES_MEM. And >>>> of course, there's a lot of unrelated stuff in RESOURCES_MEM. >>>> So I guess we'll need to enable QUERY_TUNING_* and then selectively a >>>> couple of individual options from other groups. >>> >>> This is putting way too much policy into the mechanism, if you ask me. >>> >> >> Doesn't that depend on how it'd be implemented? I have not envisioned to >> make these decisions in explain.c, but rather to keep them in guc.c >> somehow. Say in a function like this: >> >> bool guc_affects_query_planning(config_generic *conf); >> >> which would be a fairly simple check outlined before (QUERY_TUNING_* >> plus a couple of individual GUCs). Other use cases might provide similar >> filters. > > If we were to do that, I'd suggest implementing a GUC_* flag specified > in the definition of the GUC, rather than a separate function containing > all the knowledge (but such a function could obviously still be used to > return such a fact). > Seems reasonable. > >> An alternative would be to somehow track this in the GUC definitions >> directly (similarly to how we track the group), but that seems rather >> inflexible and I'm not sure how would that handle ad-hoc use cases. > > Not sure what problem you see here? > My main concern with that was how many flags could we need, if we use this as the way to implement this and similar use cases. There are 32 bits available, and 24 of them are already used for GUC_* flags. So if we use this as an "official" way to support similar use cases, we could run out of space pretty fast. The callback would also allow ad hoc filtering, which is not very practical from extensions (e.g. you can't define a new flag, because it might conflict with something defined in another extension). But I think that's nonsense - so far we have not seen any such use case, so it's pretty pointless to design for it. If that changes and some new use case is proposed in the future, we can rethink this based on it. I'll go with a new flag, marking all GUCs related to query planning, and post a new patch soon. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services