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 1hNuYw-0002Ir-3T for pgsql-hackers@arkaria.postgresql.org; Tue, 07 May 2019 07:30:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hNuYu-0008Pf-Or for pgsql-hackers@arkaria.postgresql.org; Tue, 07 May 2019 07:30:52 +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 1hNuYu-0008PY-GS for pgsql-hackers@lists.postgresql.org; Tue, 07 May 2019 07:30:52 +0000 Received: from xvm-110-146.dc2.ghst.net ([46.226.110.146] helo=fetter.org) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hNuYr-0006Ag-9e for pgsql-hackers@postgresql.org; Tue, 07 May 2019 07:30:52 +0000 Received: by fetter.org (Postfix, from userid 1001) id 82EB942BC3; Tue, 7 May 2019 09:30:47 +0200 (CEST) Date: Tue, 7 May 2019 09:30:47 +0200 From: David Fetter To: PostgreSQL Development Subject: New EXPLAIN option: ALL Message-ID: <20190507073046.GI28936@fetter.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="H83aLI5Lttn3Hg7B" Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --H83aLI5Lttn3Hg7B Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Folks, It can get a little tedious turning on (or off) all the boolean options to EXPLAIN, so please find attached a shortcut. Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate --H83aLI5Lttn3Hg7B Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-Add-an-ALL-option-to-EXPLAIN.patch" From 8de75e81eb7161c712e2af97b0619a69f33c6b91 Mon Sep 17 00:00:00 2001 From: David Fetter Date: Tue, 7 May 2019 00:26:29 -0700 Subject: [PATCH v1] Add an ALL option to EXPLAIN To: hackers MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.21.0" This is a multi-part message in MIME format. --------------2.21.0 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit which starts all boolean options at once. diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml index 385d10411f..ade3793c5f 100644 --- a/doc/src/sgml/ref/explain.sgml +++ b/doc/src/sgml/ref/explain.sgml @@ -43,6 +43,7 @@ EXPLAIN [ ANALYZE ] [ VERBOSE ] statementboolean ] TIMING [ boolean ] SUMMARY [ boolean ] + ALL [ boolean ] FORMAT { TEXT | XML | JSON | YAML } @@ -224,6 +225,16 @@ ROLLBACK; + + ALL + + + Include (or exclude) all of the above settings before examining the rest + of the options. It defaults to FALSE. + + + + FORMAT diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index a6c6de78f1..966f4566c7 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -151,6 +151,26 @@ ExplainQuery(ParseState *pstate, ExplainStmt *stmt, const char *queryString, bool summary_set = false; /* Parse options list. */ + /* First, see whether ALL is set */ + foreach(lc, stmt->options) + { + DefElem *opt = (DefElem *) lfirst(lc); + + if (strcmp(opt->defname, "all") == 0) + { + es->analyze = defGetBoolean(opt); + es->verbose = defGetBoolean(opt); + es->costs = defGetBoolean(opt); + es->buffers = defGetBoolean(opt); + es->settings = defGetBoolean(opt); + timing_set = true; + es->timing = defGetBoolean(opt); + summary_set = true; + es->timing = defGetBoolean(opt); + } + } + + /* If you add another boolean option here, remember to add it above, too */ foreach(lc, stmt->options) { DefElem *opt = (DefElem *) lfirst(lc); --------------2.21.0-- --H83aLI5Lttn3Hg7B--