Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oldest_xmin missing xmin from replication_slots #286

Open
Krysztophe opened this issue Apr 15, 2021 · 0 comments
Open

oldest_xmin missing xmin from replication_slots #286

Krysztophe opened this issue Apr 15, 2021 · 0 comments
Assignees
Labels

Comments

@Krysztophe
Copy link
Collaborator

With such primary slots:

[local]:10021 postgres@pgbench=# select * from pg_replication_slots ;
 slot_name | plugin | slot_type | datoid | database | temporary | active | active_pid |  xmin   | catalog_xmin | restart_lsn | confirmed_flush_lsn 
-----------+--------+-----------+--------+----------+-----------+--------+------------+---------+--------------+-------------+---------------------
 abeille4  | ¤      | physical  |      ¤ | ¤        | f         | t      |    2454458 | 7995805 |            ¤ | 8/AC000F60  | ¤
 abeille2  | ¤      | physical  |      ¤ | ¤        | f         | t      |    2454173 | 7995805 |            ¤ | 8/AC000F60  | ¤
 abeille3  | ¤      | physical  |      ¤ | ¤        | f         | f      |          ¤ |       ¤ |            ¤ | 8/A25AD5B0  | ¤

the oldest_xmin query

$PG_VERSION_94 => q{

returns an empty result:

  datname  |    kind     | age | xmin 
-----------+-------------+-----+------
 postgres  | repslot     |   ¤ |    ¤
 postgres  | active_xact |   ¤ |    ¤
 pgbench   | query       |   ¤ |    ¤
 template1 | 2pc         |   ¤ |    ¤
 template1 | idle_xact   |   ¤ |    ¤
 pgbench   | repslot     |   ¤ |    ¤
 pgbench   | active_xact |   ¤ |    ¤
 postgres  | query       |   ¤ |    ¤
 template1 | walsender   |   ¤ |    ¤
 template1 | repslot     |   ¤ |    ¤
 pgbench   | idle_xact   |   ¤ |    ¤
 template1 | active_xact |   ¤ |    ¤
 pgbench   | walsender   |   ¤ |    ¤
 postgres  | 2pc         |   ¤ |    ¤
 postgres  | idle_xact   |   ¤ |    ¤
 postgres  | walsender   |   ¤ |    ¤
 template1 | query       |   ¤ |    ¤
 pgbench   | 2pc         |   ¤ |    ¤

although the part of the query that queries it is okay:

  SELECT 'repslot' AS kind,
pgbench-#             database AS datname,
pgbench-#             xmin AS xmin
pgbench-#             FROM  pg_replication_slots;

  kind   | datname |  xmin   
---------+---------+---------
 repslot | ¤       | 7995805
 repslot | ¤       | 7995805
 repslot | ¤       |       ¤

The datname is empty and it is filtered in the RIGHT JOIN at the end.

When replacing it with a FULL OUTER JOIN and adding 2 COALESCE, I obtain this, which is much more useful:

  datname  |    kind     | age |  xmin   
-----------+-------------+-----+---------
 ¤         | active_xact |   ¤ |       ¤
 ¤         | repslot     |   0 | 7995805
 ¤         | walsender   |   ¤ |       ¤
 postgres  | repslot     |   ¤ |       ¤
 postgres  | active_xact |   ¤ |       ¤
 pgbench   | query       |   ¤ |       ¤
 template1 | 2pc         |   ¤ |       ¤
 template1 | idle_xact   |   ¤ |       ¤
 pgbench   | repslot     |   ¤ |       ¤
 pgbench   | active_xact |   ¤ |       ¤
 postgres  | query       |   ¤ |       ¤
 template1 | walsender   |   ¤ |       ¤
 template1 | repslot     |   ¤ |       ¤
 pgbench   | idle_xact   |   ¤ |       ¤
 template1 | active_xact |   ¤ |       ¤
 pgbench   | walsender   |   ¤ |       ¤
 postgres  | 2pc         |   ¤ |       ¤
 postgres  | idle_xact   |   ¤ |       ¤
 postgres  | walsender   |   ¤ |       ¤
 template1 | query       |   ¤ |       ¤
 pgbench   | 2pc         |   ¤ |       ¤

I'm wondering it this should not have been a LEFT JOIN from the beginning.
So many empty values pollute the perfdata.

Or did I miss something?

@rjuju rjuju added the bug label Feb 25, 2022
@ioguix ioguix self-assigned this Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants