| From: | Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [PATCH] Change wait_time column of pg_stat_lock to double precision |
| Date: | 2026-06-27 17:50:38 |
| Message-ID: | CAHza6qfBekuduuD5UuChuuy462D8JDBLfNwFnq3cN+7hGT4n7A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Bertrand-san,
Thank you for your review!
> === 1
>
> -pgstat_count_lock_waits(uint8 locktag_type, long msecs)
> +pgstat_count_lock_waits(uint8 locktag_type, double msecs)
>
> What about keeping the long and rename to usecs?
Agreed. Fixed.
> === 2
>
> - pgstat_count_lock_waits(locallock->tag.lock.locktag_type, msecs);
> + pgstat_count_lock_waits(locallock->tag.lock.locktag_type,
> + (double) msecs + (double) usecs /
1000.0);
>
> would:
>
> - msecs = secs * 1000 + usecs / 1000;
> - usecs = usecs % 1000;
>
> /* Increment the lock statistics counters if done
waiting. */
> if (myWaitStatus == PROC_WAIT_STATUS_OK)
> -
pgstat_count_lock_waits(locallock->tag.lock.locktag_type, msecs);
> +
pgstat_count_lock_waits(locallock->tag.lock.locktag_type, secs * 1000000 +
usecs);
> +
> + msecs = secs * 1000 + usecs / 1000;
> + usecs = usecs % 1000;
Agreed. Fixed.
> === 3
>
> - values[i++] = Int64GetDatum(lck_stats->wait_time);
> + values[i++] = Float8GetDatum(lck_stats->wait_time);
>
> Then, what about doing:
>
> values[i++] = Float8GetDatum((double) lck_stats->wait_time / 1000.0);
>
> instead?
Agreed. Fixed.
> === 4
>
> and instead of:
>
> - PgStat_Counter wait_time; /* time in milliseconds */
> + double wait_time; /* time in milliseconds */
>
> only change the comment here: to microseconds (but keep PgStat_Counter as
type).
>
> The idea being to keep the PgStat_Counter type, the long parameter type
and
> do the conversion at display time.
Agreed. Fixed.
v2 attached.
Regards,
Tatsuya Kawata
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Change-wait_time-column-of-pg_stat_lock-to-double.patch | application/octet-stream | 5.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-06-27 18:04:22 | Re: Move FOR PORTION OF checks out of analysis |
| Previous Message | Peter Eisentraut | 2026-06-27 17:43:40 | Re: Move FOR PORTION OF checks out of analysis |