Re: Add comment explaining why queryid is int64 in pg_stat_statements

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Shaik Mohammad Mujeeb <mujeeb(dot)sk(at)zohocorp(dot)com>
Cc: ilyaevdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, mujeebskdev <mujeeb(dot)sk(dot)dev(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add comment explaining why queryid is int64 in pg_stat_statements
Date: 2025-05-17 12:49:23
Message-ID: aCiF0xs95EUBNery@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Jackson 2025-05-17 13:41:43 Re: Add Option To Check All Addresses For Matching target_session_attr
Previous Message wenhui qiu 2025-05-17 03:36:19 Re: Add comment explaining why queryid is int64 in pg_stat_statements