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 1gXpSN-0002Zt-H8 for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Dec 2018 15:32:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gXpSL-0001TI-Sf for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Dec 2018 15:32:49 +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 1gXpSL-0001TB-LL for pgsql-hackers@lists.postgresql.org; Fri, 14 Dec 2018 15:32:49 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXpSI-0005Gd-SP for pgsql-hackers@lists.postgresql.org; Fri, 14 Dec 2018 15:32:49 +0000 Received: by mail-wr1-x442.google.com with SMTP id p4so5821572wrt.7 for ; Fri, 14 Dec 2018 07:32:46 -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=lsIlrzZ9Pcyy2EG6SGyvzovhDiqZTgxq3IdjV2md4wE=; b=eCXRPfZ95hYer4jhd8mLZEdUlYXgvF3hJOV5DJ/00lVGvELvfyMbeBdqnF++ya8zXC kzdr02i04yhVCMVVoOyPIw7OYHfjdjL+OYya7oATF2SZi/vAoJGm7JYewYQsyCPh0gXD ybTVSQaH1ZKi0BDB7gyifltwD+8m+KeWgEv5XN6a4diR7uJkNu1R4E6nWGAKzzmbkSsW 5LUow8QZklKrCfytSSIwM/pHieLu2n6eTjPWZPy1fcwY6bQFg355YeimZJXFQsJdH72V eP6PzWFibaLvx5ABYdHtOEHME7M25orLbqqnpNI6K5s5Eltj2/1boFrtlTXyvi5R+1X+ vrhA== 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=lsIlrzZ9Pcyy2EG6SGyvzovhDiqZTgxq3IdjV2md4wE=; b=Gv4VLX/udrS40IGvxxWcVjWOfC75KGRtOutMZ558bdq5iuJ6ZK495JPfDMAxRaKACh 5uDKOxfx7PTgbNJpFUALnn1bJjCNEBl1WA4iVmLPvp1Eijo3iJxipNr+55uG10dqWqk+ ZeeusVPM3gYfx4nUOad7LsHS/iiDBde3/alcEKWWnnE5auv3g+sEnhE21/maDG3DFkAC rwpuxeMAx2K0UV/Y6oDZY51W4uumtBlru/SdCtRHRynyuNVzAvBc4lv9s+iWY/vu45aX SZsjSgMHyUX/gVSlYm61bxjTOxKr0P7hFZDF4eK39Lbg1Oor9wbg/LCbwqieDwf3qYEl iXZw== X-Gm-Message-State: AA+aEWZnm+yyqG1Lvs3pVPoBMWMQMAqiugyzEMwPPsQUmjHHPZhrQlIm vsdiHRYYhxic+rZ+I4Ag/Q00AO/9zruXbaRLnygvXJhvzAwoKNNn6CbeY7YSE0YtZ6JEw76LZJz ae3FBSBTAHyihWIb/2/gFim5iPQaOwfL5jZb8mb/zX/Uurp/330bNe6lR5QIPE7kWqq7rYS6jFf jVsdI+Z5qfzfWQeV4mMQTIh3XA X-Google-Smtp-Source: AFSGD/UZPdocGOSJUN8uOQgdZb8zl30q11uq2kJ5WSiyXkPX/2axdDzfxuNzw2PYeqv2TCzU5uxOxg== X-Received: by 2002:adf:fe8f:: with SMTP id l15mr2846701wrr.313.1544801565027; Fri, 14 Dec 2018 07:32:45 -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 c129sm4725697wma.48.2018.12.14.07.32.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 07:32:44 -0800 (PST) Subject: Re: explain plans with information about (modified) gucs To: Tom Lane Cc: PostgreSQL Hackers References: <10561.1544800904@sss.pgh.pa.us> From: Tomas Vondra Message-ID: Date: Fri, 14 Dec 2018 16:32:42 +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: <10561.1544800904@sss.pgh.pa.us> 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/14/18 4:21 PM, Tom Lane wrote: > Tomas Vondra writes: >> ... I propose to extend EXPLAIN output with an additional option, which >> would include information about modified GUCs in the execution plan >> (disabled by default, of course): > > I'm a bit suspicious about whether this'll have any actual value, > if it's disabled by default (which I agree it needs to be, if only for > compatibility reasons). The problem you're trying to solve is basically > "I forgot that this might have an effect", but stuff that isn't shown > by default will not help you un-forget. It certainly won't fix the > form of the problem that I run into, which is people sending in EXPLAIN > plans and not mentioning their weird local settings. > Not quite. I agree we'll still have to deal with plans from users without this info, but it's easier to ask for explain with this extra option (just like we regularly ask for explain analyze instead of just plain explain). I'd expect the output to be more complete than trying to figure out which of the GUCs might have effect / been modified here. But more importantly - my personal primary use case here is explains from application connections generated using auto_explain, with some application-level GUC magic. And there I can easily tweak auto_explain config to do (auto_explain.log_gucs = true) of course. >> We certainly don't want to include all GUCs, so the question is how to >> decide which GUCs are interesting. The simplest approach would be to >> look for GUCs that changed in the session (source == PGC_S_SESSION), but >> that does not help with SET SESSION AUTHORIZATION / ROLE cases. So we >> probably want (source > PGC_S_ARGV), but probably not PGC_S_OVERRIDE >> because that includes irrelevant options like wal_buffers etc. > > Don't you want to show anything that's not the built-in default? > (I agree OVERRIDE could be excluded, but that's irrelevant for query > tuning parameters.) Just because somebody injected a damfool setting > of, say, random_page_cost via the postmaster command line or > environment settings doesn't make it not damfool :-( > Probably. My assumption here was that I can do select * from pg_settings and then combine it with whatever is included in the plan. But you're right comparing it with the built-in default may be a better option. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services