SHOW_POOL_HEALTH_CHECK_STATS(1)

โœจ SHOW_POOL_HEALTH_CHECK_STATS โœจ

okay bestie, gather round, because this one's from the pgpool-II 4.7.2 Documentation and it is lowkey iconic ๐Ÿซถ the manpage is literally called SHOW_POOL...ECK_STATS(1) when it's all squished into the header, but the whole vibe is:

๐Ÿ’– NAME ๐Ÿ’–

SHOW_POOL_HEALTH_CHECK_STATS โ€” show health check statistics data. that's it, that's the girl ๐ŸŽ€


๐ŸŒธ SYNOPSIS ๐ŸŒธ

SHOW POOL_HEALTH_CHECK_STATS

no args, no flags, just pure unhinged confidence. she walks in, she says her name, she leaves. periodt ๐Ÿ’…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so SHOW POOL_HEALTH_CHECK_STATS spills the tea on health check stats โ€” and yes, bestie, health check is a whole thing, it lives over in Section 5.9, โ€œHealth Checkโ€, in the documentation if you wanna go read up ๐Ÿ‘€ โ€” and most of this statistic data is collected by the health check process.

this command is genuinely a gift for a Pgpool-II admin who wants to study events related to health check, like fr fr.

for example โ€” and stay with me here โ€” an admin can easily locate the failover event in the log file by looking at the "last_failed_health_check" column. like, boom, there it is, the moment everything went sideways ๐Ÿ˜ญ iconic detective work.

another example: you can find an unstable connection to backend by evaluating the "average_retry_count" column. if a particular node shows a higher retry count than the other node, then there may be a problem with the connection to the backend. that's it, that's the vibe check, and she is failing ๐Ÿ’€

and then, to top it all off, Table 29, โ€œStatistics data shown by pool_health_check_stats commandโ€ shows each column name and its description. every single one. we love a receipts moment ๐Ÿ“


more coming bestie, don't go anywhere ๐Ÿ’œ


Table 29. Statistics data shown by pool_health_check_stats command ๐ŸŽ€

bestie this is the whole column-by-column tea โ˜• every single field this command spits out, explained with zero gatekeeping:

  • node_id โ€” the backend node id ๐Ÿ†”
  • hostname โ€” the backend hostname, or a UNIX domain socket path if that's how you're rolling ๐Ÿ”Œ
  • port โ€” the backend port number ๐Ÿ”ข
  • status โ€” the backend status, and it's exactly one of up, down, waiting, unused or quarantine (yes that last one is giving dramatic but it's real ๐Ÿ’…)
  • role โ€” the role of the node. In streaming replication mode it's either primary or standby. In any other mode it's either main or replica ๐Ÿ‘‘
  • last_status_change โ€” timestamp of the last time the backend status changed โฐ
  • total_count โ€” number of health check counts in total ๐Ÿงฎ
  • success_count โ€” number of successful health check counts in total โœ…
  • fail_count โ€” number of failed health check counts in total ๐Ÿ˜ญ
  • skip_count โ€” number of skipped health check counts in total. If the node is already down, health check skips the node ๐Ÿ™ˆ
  • retry_count โ€” number of retried health check counts in total ๐Ÿ”
  • average_retry_count โ€” number of average retried health check counts in a health check session ๐Ÿ“Š
  • max_retry_count โ€” number of maximum retried health check counts in a health check session ๐Ÿ”
  • max_duration โ€” maximum health check duration in milliseconds. If a health check session retries, the health check duration is the sum of each retried health check โŒ›
  • min_duration โ€” minimum health check duration in milliseconds. If a health check session retries, the health check duration is the sum of each retried health check ๐Ÿฃ
  • average_duration โ€” average health check duration in milliseconds. If a health check session retries, the health check duration is the sum of each retried health check ๐Ÿ“ˆ
  • last_health_check โ€” timestamp of the last health check. If a health check has not been performed yet, it's an empty string ๐Ÿซฅ
  • last_successful_health_check โ€” timestamp of the last successful health check. If a health check has not succeeded yet, it's an empty string ๐ŸŒŸ
  • last_skip_health_check โ€” timestamp of the last skipped health check. If a health check has not been skipped yet, it's an empty string. โš ๏ธ Note that it's possible for this field to be an empty string even if the status is down โ€” in that case, the failover was triggered by something other than the health check process ๐Ÿ‘€
  • last_failed_health_check โ€” timestamp of the last failed health check. If a health check has not failed yet, it's an empty string. โš ๏ธ Note that it's possible for this field to be an empty string even if the status is down โ€” in that case, the failover was triggered by something other than the health check process ๐Ÿ’€

Here is an example session: โœจ

โ€ฆand it spits out something that looks exactly like this, bestie โ€” two records, one per node, and yes we're reading every single line ๐Ÿ‘‘

           test=# show pool_health_check_stats;
           -[ RECORD 1 ]----------------+--------------------
           node_id                      | 0
           hostname                     | /tmp
           port                         | 11002
           status                       | up
           role                         | primary
           last_status_change           | 2020-01-26 19:08:45
           total_count                  | 27
           success_count                | 27
           fail_count                   | 0
           skip_count                   | 0
           retry_count                  | 0
           average_retry_count          | 0.000000
           max_retry_count              | 0
           max_duration                 | 9
           min_duration                 | 2
           average_duration             | 6.296296
           last_health_check            | 2020-01-26 19:12:45
           last_successful_health_check | 2020-01-26 19:12:45
           last_skip_health_check       |
           last_failed_health_check     |
           -[ RECORD 2 ]----------------+--------------------
           node_id                      | 1
           hostname                     | /tmp
           port                         | 11003
           status                       | down
           role                         | standby
           last_status_change           | 2020-01-26 19:11:48
           total_count                  | 19
           success_count                | 12
           fail_count                   | 1
           skip_count                   | 6
           retry_count                  | 3
           average_retry_count          | 0.230769
           max_retry_count              | 3
           max_duration                 | 83003
           min_duration                 | 0
           average_duration             | 6390.307692
           last_health_check            | 2020-01-26 19:12:48
           last_successful_health_check | 2020-01-26 19:10:15
           last_skip_health_check       | 2020-01-26 19:12:48
           last_failed_health_check     | 2020-01-26 19:11:48

โœจ okay but what am I LOOKING at โœจ

-[ RECORD 1 ]`- is fully giving nothing to see here, I am unbothered, I am moisturized. Check it out ๐Ÿง–โ€โ™€๏ธ

  • node_id is 0, sitting on hostname /tmp at port 11002, status is up and its role is primary โ€” main character behavior fr fr ๐Ÿ‘‘
  • last_status_change says 2020-01-26 19:08:45, and then it's twenty-seven for twenty-seven: total_count 27, success_count 27, fail_count 0, skip_count 0, retry_count 0 ๐ŸŒˆ
  • all that retry math is a perfect little zero: average_retry_count 0.000000, max_retry_count 0
  • durations: max_duration 9, min_duration 2, average_duration 6.296296 โ€” tight, tidy, iconic ๐Ÿ’…
  • last_health_check and last_successful_health_check are both 2020-01-26 19:12:45, while last_skip_health_check and last_failed_health_check areโ€ฆ literally blank. Nothing there. Not a single character. And given fail_count is 0 and skip_count is 0, that tracks perfectly ๐Ÿคทโ€โ™€๏ธ

-[ RECORD 2 ]`- on the other hand is giving I have been through things ๐Ÿ˜ญ

  • node_id 1, same hostname /tmp, but port 11003, status down, role standby
  • last_status_change 2020-01-26 19:11:48
  • counts are messier this time: total_count 19, success_count 12, fail_count 1, skip_count 6, retry_count 3 ๐Ÿ˜ฎโ€๐Ÿ’จ
  • retry numbers actually woke up: average_retry_count 0.230769, max_retry_count 3
  • and the durations?? max_duration 83003, min_duration 0, average_duration 6390.307692. Ma'am that is a lot bigger than 9. It is not the same vibe as record 1 at all ๐Ÿ’€
  • all four timestamps are actually filled in for this one โ€” last_health_check 2020-01-26 19:12:48, last_successful_health_check 2020-01-26 19:10:15, last_skip_health_check 2020-01-26 19:12:48, last_failed_health_check 2020-01-26 19:11:48 ๐Ÿ•ฐ๏ธ
heads up bestie: read the columns, don't โœจ extrapolate โœจ. The numbers in this example are the numbers in this example. Copy the shapes, not the story you made up about them ๐Ÿ™ˆ

๐ŸŽ€ and that's the whole page ๐ŸŽ€

That's literally it โ€” every option, every count, every timestamp, every blank cell, all of it, sitting right there for you to scroll through like a group chat from three hours ago ๐Ÿซถ

This whole thing lives under pgpool-II 4.7.2, dated 2023, and yeah the footer is just the page name doing its little signature at the bottom: SHOW POOLโ€ฆECK_STATS(1). Go check on your nodes, put your phone down, drink some water, and may all your status columns read up โœจ๐Ÿ’–๐ŸŒธ๐Ÿ’œ๐ŸŒŸ

๐Ÿ“ฆ where this page comes from