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 1hIbOR-0007GB-PH for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2019 16:02:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIbOQ-0001ny-EK for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2019 16:02:06 +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 1hIbOQ-0001nr-4s for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2019 16:02:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIbOO-00079v-2f for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2019 16:02:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x3MG21fX015375; Mon, 22 Apr 2019 12:02:01 -0400 From: Tom Lane To: Souvik Bhattacherjee cc: "pgsql-generallists.postgresql.org" Subject: Re: Is it possible to store the output of EXPLAIN into a table In-reply-to: References: Comments: In-reply-to Souvik Bhattacherjee message dated "Mon, 22 Apr 2019 11:27:18 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15373.1555948921.1@sss.pgh.pa.us> Date: Mon, 22 Apr 2019 12:02:01 -0400 Message-ID: <15374.1555948921@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Souvik Bhattacherjee writes: > I was just wondering if it is possible to store the output of EXPLAIN into > a table. EXPLAIN won't do that directly, but you could make a plpgsql function along the lines of for t in execute explain ... return next t; (too lazy to check the exact details here, but I believe you can find related examples in our regression tests) and then store the function's result into a table. regards, tom lane