Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sM1x2-000I1I-QH for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Jun 2024 08:54:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sM1x0-00EZzm-IC for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Jun 2024 08:54:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sM1x0-00EZze-5l for pgsql-hackers@lists.postgresql.org; Tue, 25 Jun 2024 08:54:54 +0000 Received: from mail-ua1-x934.google.com ([2607:f8b0:4864:20::934]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sM1wy-003S1Q-A7 for pgsql-hackers@lists.postgresql.org; Tue, 25 Jun 2024 08:54:53 +0000 Received: by mail-ua1-x934.google.com with SMTP id a1e0cc1a2514c-80f4f7e6856so1205564241.2 for ; Tue, 25 Jun 2024 01:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719305690; x=1719910490; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=gxyiz98X61mf9UcHhpW/Ibc/R6fHWiQx8c2kRBBC6No=; b=iOtJvR6Q7mTKTbO5snLeUEWk/EVjPWI0beFC826mbPsAI+INFSUhNIZ9XXtppr4PUA JHg9Cvz8u6eo6mV3NgDcQMhr0AJy7iQvQ5sY6+V1s/q5vM0aLEfQTSzXPubPNIW7FrDI aSArUjKZaREngNgJBh3y3vVss2Af/pv9WNrkkEBkPIdUSXkFncJPbzwjhq8Vfles8AXu Hw7wkyQHC0n+SRCpIAVv4C4+qAQ6+21vQpC+o4q+IsOiyTaPfazN48z+stqNgLjjMGkt UmdzAn8K0/084hTc8GSdLCEWIL7XrfZdcUC4NUaZq0e1NojUrP7s4gOtNM6NitzGctl+ Mz2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719305690; x=1719910490; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gxyiz98X61mf9UcHhpW/Ibc/R6fHWiQx8c2kRBBC6No=; b=ZQVYlVKbsRK/GzJQslAHx7bVyvB8hzGDtBt7iuTWZMiFiVPzA4tSH8gpGThGnUPryc zdG2tlT0BdxsDsbdq4Buu1PdWXttTDfHO2i56vgbdtWWa4t/ULWcgzQfoq1Ic6dd1zKG a3aDYKiSfQtUtnG+EJ84ieJk8XX55jjBeefyf3qQhEhTw5jMlIuv+c19yjxY9QUC7/UR K64FvbANpU9qSWodRLHgZKVOqu/NZyvx5pyXveaWsJFTUmIWSggWHyIojNlNiUweaWUw 5Pj17fGosmxsl/Sto5EXEN2QRBQeF/uR5ZAwn5jV2r4+pZilQIpdufPdSBZJpXJ8TqFU NxpA== X-Gm-Message-State: AOJu0YxtQhki1IP+o9tCbv54pL1Dv4d3sE18dfolPAM0VjwPaHdCPdz5 F+geaLpD7NdBCkaGJXFyy+Tmlkq/qt1E91bu2M1swgQVIV12gr4+7goOAX+gxOqg2d7rYr/Ev5u s971AksHYtdCHjf/4OlUrs1c3jWKQyNfN X-Google-Smtp-Source: AGHT+IE9sM/z2TbbWGPEkZ6eaXBRqtppy+4kZT2Cq+LdmxC8QkslDoffpGLEfQdbMIwOOWzn6TLCAgU97VJpAD8cdHU= X-Received: by 2002:a05:6122:4587:b0:4ef:52e2:6763 with SMTP id 71dfb90a1353d-4ef6a78b42dmr6216049e0c.13.1719305690111; Tue, 25 Jun 2024 01:54:50 -0700 (PDT) MIME-Version: 1.0 From: jian he Date: Tue, 25 Jun 2024 16:54:00 +0800 Message-ID: Subject: add a new explain option including_query for include query string inside the json plan output To: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk for json format, add a new option to let the explain json output also include the actual query string. it can make json usage more convenient. Now you only need to grab the json output, no need to collect another explain statement and extract the actual query from the explain statement. including_query name is so far what i can come up with, if people have better ideas, then we can change. example: explain (analyze,including_query on, format json) select 1; QUERY PLAN ------------------------------------- [ + {"Query": "select 1"}, + { + "Plan": { + "Node Type": "Result", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.00, + "Total Cost": 0.01, + "Plan Rows": 1, + "Plan Width": 4, + "Actual Startup Time": 0.001,+ "Actual Total Time": 0.001, + "Actual Rows": 1, + "Actual Loops": 1 + }, + "Planning Time": 0.119, + "Triggers": [ + ], + "Execution Time": 0.033 + } + ] (1 row)