From: Julien Rouhaud <rjuju123@gmail.com>
To: Jerry Brenner <jbrenner@guidewire.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Does Postgres have consistent identifiers (plan hash value) for explain plans?
Date: Mon, 4 Dec 2023 18:30:12 +0100
Message-ID: <ZW4MpD1NPiui4BqO@jrouhaud> (raw)
In-Reply-To: <CACoKFYTVi5eq2Y2v5ni1X9KrDdv8HS_fPdU_rYm6Lr6p=0wjeQ@mail.gmail.com>
References: <CACoKFYTVi5eq2Y2v5ni1X9KrDdv8HS_fPdU_rYm6Lr6p=0wjeQ@mail.gmail.com>
Hi,
On Mon, Dec 04, 2023 at 06:45:39AM -0800, Jerry Brenner wrote:
> We are currently on Postgres 13.9 (and will be moving to later releases).
> We are capturing json explain plans and storing them in a database table.
> We can tell that there are different plans for some queries, but that's a
> very labor intensive process - we'd rather do this using SQL and comparing
> consistent hash values for the plans. Both Oracle and SQL Server have
> consistent hash values for query plans and that makes it easy to identify
> when there are multiple plans for the same query. Does that concept exist
> in later releases of Postgres (and is the value stored in the json explain
> plan)?
>
> While we have a pretty good idea of how to manually generate a consistent
> value, we don't want to reinvent the wheel. Is anyone aware of an existing
> solution that can be called from SQL/jsonb?
You can look at pg_store_plans extension:
https://github.com/ossc-db/pg_store_plans, it can generate a query plan hash
and also keeps tracks of the (normalized) plans associated to each (normalized)
query.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: rjuju123@gmail.com, jbrenner@guidewire.com, pgsql-performance@lists.postgresql.org
Subject: Re: Does Postgres have consistent identifiers (plan hash value) for explain plans?
In-Reply-To: <ZW4MpD1NPiui4BqO@jrouhaud>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox