Re: Add comment explaining why queryid is int64 in pg_stat_statements
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Shaik Mohammad Mujeeb <mujeeb.sk@zohocorp.com>
Cc: ilyaevdokimov <ilya.evdokimov@tantorlabs.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, mujeebskdev <mujeeb.sk.dev@gmail.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-05-17T12:49:23Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Change internal plan ID type from uint64 to int64
- e050af28686e 18.0 landed
-
Change internal queryid type from uint64 to int64
- c3eda50b0648 18.0 landed
-
pg_stat_statements: Widen query IDs from 32 bits to 64 bits.
- cff440d36869 11.0 cited
On Fri, May 16, 2025 at 04:05:01PM +0530, Shaik Mohammad Mujeeb wrote: > This conversion is intentional - most likely to match the bigint > type of the queryid column in pg_stat_statements. However, without > an explicit comment, this can be misleading. A beginner reading this > might misinterpret it as an unintentional overflow or bug and raise > unnecessary concerns. Therefore, it´s worth adding a brief comment > clarifying the intent behind this assignment. I don't quite see the value in the comment addition you are suggesting here: all the user-facing features related to query IDs use signed 64b integers, and are documented as such in the official docs. The fact that we store an unsigned value in the backend core code is an internal implementation artifact, the important point is that we have a value stored in 8 bytes. -- Michael