Skip to content

Durations reported by SHOW STATS are in milliseconds, not microseconds #810

Open
@smcgivern

Description

@smcgivern

Describe the bug

PgBouncer reports *_time metrics in SHOW STATS in microseconds. PgCat reports the same metrics in milliseconds.

https://github.com/postgresml/pgcat/tree/main#statistics-reporting says:

The stats are very similar to what PgBouncer reports and the names are kept to be comparable

So I'd expect the units to be the same too.

PgBouncer source here: https://github.com/pgbouncer/pgbouncer/blob/e2a2a682fe9069366fca970ec2492d774b4f6b40/src/server.c#L556-L559

To Reproduce

Steps to reproduce the behavior:

  1. Run Postgres and connect both PgBouncer and PgCat.
  2. Run SELECT pg_sleep(1); via both connection poolers.
  3. Run SHOW STATS; in both connection poolers.

PgBouncer will give something like:

total_xact_count  | 1
total_query_count | 1
total_received    | 25
total_sent        | 107
total_xact_time   | 1007496
total_query_time  | 1007496
total_wait_time   | 3499
avg_xact_count    | 0
avg_query_count   | 0
avg_recv          | 0
avg_sent          | 3
avg_xact_time     | 1007496
avg_query_time    | 1007496
avg_wait_time     | 121

Whereas PgCat says:

total_xact_count  | 1
total_query_count | 1
total_received    | 107
total_sent        | 62
total_xact_time   | 0
total_query_time  | 1001
total_wait_time   | 7
total_errors      | 0
avg_xact_count    | 0
avg_query_count   | 0
avg_recv          | 7
avg_sent          | 4
avg_errors        | 0
avg_xact_time     | 0
avg_query_time    | 1001
avg_wait_time     | 0

(xact_time metrics are already reported missing in #114.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions