Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngS7p-0006jy-5g for pgsql-performance@arkaria.postgresql.org; Mon, 18 Apr 2022 14:13:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ngS7o-0005cV-0x for pgsql-performance@arkaria.postgresql.org; Mon, 18 Apr 2022 14:13:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngS7n-0005ZN-Ms for pgsql-performance@lists.postgresql.org; Mon, 18 Apr 2022 14:13:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngS7l-00058T-8u for pgsql-performance@postgresql.org; Mon, 18 Apr 2022 14:13:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 23IED3p82268717; Mon, 18 Apr 2022 10:13:03 -0400 From: Tom Lane To: Goti cc: pgsql-performance@postgresql.org Subject: Re: How to find the final transformed query in postgresql In-reply-to: References: Comments: In-reply-to Goti message dated "Mon, 18 Apr 2022 19:32:49 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2268715.1650291183.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 18 Apr 2022 10:13:03 -0400 Message-ID: <2268716.1650291183@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Goti writes: > I would like to know if postgres performs any transformations when it d= oes > the parsing? This might be helpful reading: https://www.postgresql.org/docs/current/overview.html > If yes, is there a way we can get the final transformed query? See debug_print_parse and friends [1]. Depending on what you mean by "final transformed query", you might instead want debug_print_rewritten, or maybe you want the plan, in which case EXPLAIN is a much friendlier way to look at it than debug_print_plan. regards, tom lane [1] https://www.postgresql.org/docs/current/runtime-config-logging.html#RU= NTIME-CONFIG-LOGGING-WHAT