Re: Proposal - Allow extensions to set a Plan Identifier

From: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Lukas Fittl <lukas(at)fittl(dot)com>
Subject: Re: Proposal - Allow extensions to set a Plan Identifier
Date: 2025-03-24 19:21:24
Message-ID: f5acedd6-9624-43d6-8a3e-242637ebbfaf@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi! I started reviewing it and noticed that your code repeated this
cycle maybe it would be better to put it in a separate function, for
example in the form of a name like "analyze_stmts"?

or is it possible to create a macro for them?

@@ -2016,6 +2017,17 @@ exec_bind_message(StringInfo input_message)
      */
     cplan = GetCachedPlan(psrc, params, NULL, NULL);

+    foreach(lc, cplan->stmt_list)
+    {
+        PlannedStmt *plan = lfirst_node(PlannedStmt, lc);
+
+        if (plan->planId != UINT64CONST(0))
+        {
+            pgstat_report_plan_id(plan->planId, false);
+            break;
+        }
+    }
+
     /*
      * Now we can define the portal.
      *
@@ -2170,6 +2182,17 @@ exec_execute_message(const char *portal_name,
long max_rows)
         }
     }

+    foreach(lc, portal->stmts)
+    {
+        PlannedStmt *stmt = lfirst_node(PlannedStmt, lc);
+
+        if (stmt->planId != UINT64CONST(0))
+        {
+            pgstat_report_plan_id(stmt->planId, false);
+            break;
+        }
+    }
+
     cmdtagname = GetCommandTagNameAndLen(portal->commandTag, &cmdtaglen);

--
Regards,
Alena Rybakina
Postgres Professional

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-03-24 19:26:17 Re: vacuum_truncate configuration parameter and isset_offset
Previous Message Nikolay Shaplov 2025-03-24 19:12:05 Re: vacuum_truncate configuration parameter and isset_offset