Re: Stability of queryid in minor versions

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Stability of queryid in minor versions
Date: 2024-04-15 01:00:56
Message-ID: CAApHDvocUhBPSfMucPEJJPU9UwAA5rXtMHxrS8dX64Fc5KL5oQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 15 Apr 2024 at 11:47, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>
> On Sun, Apr 14, 2024 at 7:20 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> > It's the "underlying server version" that I think needs some
> > clarification. It's unclear if the minor version must match or just
> > the major version number. The preceding paragraph does mention:
> >
> > "Furthermore, it is not safe to assume that queryid will be stable
> > across major versions of PostgreSQL."
> >
> > but not stable across *major* versions does *not* mean stable across
> > *minor* versions. The reader is just left guessing if that's true.
>
> Technically we don't promise that WAL records won't change in minor
> versions. In fact, the docs specifically state that the format of any
> WAL record might change, and that users should upgrade standbys first
> on general principle (though I imagine few do). We try hard to avoid
> changing the format of WAL records in point releases, of course, but
> strictly speaking there is no guarantee. This situation seems similar
> (though much lower stakes) to me. Query normalization isn't perfect --
> there's a trade-off.

set compute_query_id = 'on';
explain (costs off, verbose) select oid from pg_class;
QUERY PLAN
-----------------------------------------------------------------
Index Only Scan using pg_class_oid_index on pg_catalog.pg_class
Output: oid
Query Identifier: -8748805461085747951
(3 rows)

As far as I understand query ID; it's based on the parse nodes and
values in the system catalogue tables and is calculated on the local
server. Computed values are susceptible to variations in hash values
calculated by different CPU architectures.

Where does WAL fit into this? And why would a WAL format change the
computed value?

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-04-15 01:09:02 Re: Fix out-of-bounds in the function GetCommandTagName
Previous Message Michael Paquier 2024-04-15 00:29:05 Re: Fix possible dereference null pointer (src/backend/replication/logical/reorderbuffer.c)