<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>kbdiag · KingbaseES diagnostics on kbdiag</title><link>https://kevin-wenyu.github.io/kbdiag-docs/</link><description>Recent content in kbdiag · KingbaseES diagnostics on kbdiag</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Wed, 07 Oct 2026 17:33:17 +0800</lastBuildDate><atom:link href="https://kevin-wenyu.github.io/kbdiag-docs/index.xml" rel="self" type="application/rss+xml"/><item><title>Find long-running SQL</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/scenarios/slow-sql/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/scenarios/slow-sql/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. PIDs, counts and timings belong to this capture only. A fault-injection script started &lt;code&gt;select pg_sleep(3600);&lt;/code&gt;, a statement that only sleeps. It tests detection, not CPU or disk pressure.&lt;/p&gt;&#10;&lt;p&gt;kbdiag 2.0 has no slow-SQL threshold yet: a long statement is listed and sorted, but not a WARN on its own. It becomes a finding when it holds a transaction open too long (&lt;code&gt;txn&lt;/code&gt;) or makes others wait for a lock (&lt;code&gt;locks&lt;/code&gt;).&lt;/p&gt;</description></item><item><title>Read a real result</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/get-started/reading-results/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/get-started/reading-results/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. PIDs, counts and timings belong to this capture only. The idle-in-transaction session was created by a fault-injection script. The warning threshold was lowered to 5 seconds with &lt;code&gt;--idle-in-txn-warn 5&lt;/code&gt; so the example did not have to wait the default 300.&lt;/p&gt;</description></item><item><title>sessions: list sessions</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The application sessions named &lt;code&gt;kbdiag_inj_*&lt;/code&gt; were created by fault-injection scripts. PIDs, counts and timings belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-c3ef97d6-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-c3ef97d6-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag sessions [--all] [--limit N] [--idle-in-txn-warn SECONDS] [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-table-scroll td-table-scroll--static"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th scope="col"&gt;Flag&lt;/th&gt;&#10; &lt;th scope="col"&gt;Effect&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--all&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;List every session, including idle ones and background processes&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--limit N&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;Show at most N rows, default 50; &lt;code&gt;0&lt;/code&gt; shows all&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--idle-in-txn-warn SECONDS&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;WARN when a session is idle in transaction longer than this, default 300&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--json&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;Print the report as JSON&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;Connection flags &lt;code&gt;--host&lt;/code&gt;, &lt;code&gt;-p&lt;/code&gt;, &lt;code&gt;-d&lt;/code&gt;, &lt;code&gt;-U&lt;/code&gt; and &lt;code&gt;--timeout&lt;/code&gt; are global. Defaults: local socket in &lt;code&gt;/tmp&lt;/code&gt;, port 54321, database &lt;code&gt;test&lt;/code&gt;, user &lt;code&gt;system&lt;/code&gt;. The password comes from &lt;code&gt;PGPASSWORD&lt;/code&gt; or &lt;code&gt;~/.pgpass&lt;/code&gt;. The connection runs read-only transactions and sets &lt;code&gt;lock_timeout&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Investigate lock waits</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/scenarios/lock-waits/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/scenarios/lock-waits/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. PIDs, counts and timings belong to this capture only. A fault-injection script opened a transaction that took an &lt;code&gt;ACCESS EXCLUSIVE&lt;/code&gt; lock on a test table and then sat idle, and a second session tried to read the table.&lt;/p&gt;&#10;&lt;h2 id="1-who-is-waiting"&gt;1. Who is waiting?&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-a01fbf3f-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="bash" data-td-line-count="2"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-a01fbf3f-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/kbdiag locks&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;EXIT_CODE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-a01fbf3f-fence-1" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="13"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-a01fbf3f-fence-1-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;locks WARN (KingbaseES V008R006C009B0014, primary, system@local, 2026-09-27T13:36:33+08:00)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[WARN] lock.waiting session 1048829 has waited 13s for AccessShareLock on public.kbdiag_inj_lock, blocked by 1048819&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; verify: kbdiag session 1048819 # what the blocking session is doing&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;blockers: 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pid blocks holds&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 1048819 1 public.kbdiag_inj_lock AccessExclusiveLock&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;waiting: 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pid object wants waited blocked by&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 1048829 public.kbdiag_inj_lock AccessShareLock 13s 1048819&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;EXIT_CODE=1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Session 1048829 has waited 13 seconds for &lt;code&gt;AccessShareLock&lt;/code&gt; on &lt;code&gt;public.kbdiag_inj_lock&lt;/code&gt;; the direct blocker is 1048819. Waits over 10 seconds are a WARN (&lt;code&gt;--lock-wait-warn&lt;/code&gt; changes this).&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;blockers&lt;/code&gt; comes first, because the first question is who is in the way. It shows 1048819 blocks one session and holds &lt;code&gt;AccessExclusiveLock&lt;/code&gt; on the table. When one blocker holds up dozens of sessions, it is the top row.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;waiting&lt;/code&gt; lists each waiting session, longest wait first. The wait is measured from the waiter&amp;rsquo;s last state change, so it can overstate the wait a little, never understate it.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="2-what-is-the-blocker-doing"&gt;2. What is the blocker doing?&#10;&lt;/h2&gt;&#10;&lt;p&gt;Follow the &lt;code&gt;verify&lt;/code&gt; line:&lt;/p&gt;</description></item><item><title>session: one session</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/session/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/session/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The sessions in the examples were created by fault-injection scripts: 1045715 holds an exclusive lock on table &lt;code&gt;kbdiag_inj_lock&lt;/code&gt; idle in transaction, 1045724 waits for it, and 1045809 is a second session idle in transaction. PIDs, counts and timings belong to this capture only.&lt;/p&gt;</description></item><item><title>locks: lock waits</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/locks/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/locks/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The lock waits were created by fault-injection scripts. On the primary, 1045715 holds an exclusive lock on table &lt;code&gt;kbdiag_inj_lock&lt;/code&gt; idle in transaction and 1045724 waits for it. A prepared (two-phase) transaction holds a lock on &lt;code&gt;kbdiag_inj_2pc&lt;/code&gt;, and 1046007 waits for that. PIDs, counts and timings belong to this capture only.&lt;/p&gt;</description></item><item><title>txn: transactions</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/txn/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/txn/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The transactions in the examples were created by fault-injection scripts: two sessions idle in transaction (one holding a table lock), sessions waiting for locks, a &lt;code&gt;pg_sleep(3600)&lt;/code&gt;, and &lt;code&gt;kbdiag_inj_2pc&lt;/code&gt;, a prepared transaction that was neither committed nor rolled back. PIDs, counts and timings belong to this capture only.&lt;/p&gt;</description></item><item><title>waits: wait events</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/waits/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/waits/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The sessions in the examples were created by fault-injection scripts: two sessions idle in transaction, two waiting for table locks, and a &lt;code&gt;pg_sleep(3600)&lt;/code&gt;. PIDs, counts and timings belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-2a546147-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-2a546147-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag waits [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;No options of its own. Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>status: instance overview</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/status/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/status/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The FAIL example was created by a fault-injection script that fills every connection ordinary users may open. Values belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-dba55458-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-dba55458-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag status [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;status has no options of its own. Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>slots: replication slots</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/slots/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/slots/</guid><description>&lt;p&gt;Captured on 2026-09-27 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;93bf65d&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The WARN example was created by a fault-injection script. It pauses the standby&amp;rsquo;s WAL receiver (SIGSTOP), so after &lt;code&gt;wal_sender_timeout&lt;/code&gt; (30 seconds here) the primary&amp;rsquo;s slot turns inactive, as it does when a standby dies. Values belong to this capture only.&lt;/p&gt;</description></item><item><title>space: disk, WAL, databases</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/space/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/space/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. Everything here comes from the healthy lab and from two accounts that cannot see everything: &lt;code&gt;kbdiag_ro&lt;/code&gt; (no monitoring role) over &lt;code&gt;127.0.0.1&lt;/code&gt;, and &lt;code&gt;kbdiag_ro&lt;/code&gt; over the node&amp;rsquo;s network address. No fault was injected for this command. The one FAIL it can report was not produced in the lab (see the last section). Values belong to this capture only.&lt;/p&gt;</description></item><item><title>freeze: wraparound distance</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/freeze/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/freeze/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. Both nodes were healthy and nothing was injected, so every example is OK. The WARN and FAIL cases were not produced in the lab (see the last section). Values belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-5123dfcf-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-5123dfcf-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag freeze [--limit N] [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-table-scroll td-table-scroll--static"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th scope="col"&gt;Option&lt;/th&gt;&#10; &lt;th scope="col"&gt;Effect&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--limit N&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;Show at most N tables; default 20, &lt;code&gt;0&lt;/code&gt; for all&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--json&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;Print JSON&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt;. &lt;code&gt;--limit&lt;/code&gt; only trims the table list; the findings always cover every database and every table.&lt;/p&gt;</description></item><item><title>vacuum: dead tuples and autovacuum</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/vacuum/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/vacuum/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The WARN example was created by an injection script: it made table &lt;code&gt;public.kbdiag_inj_dead&lt;/code&gt; with &lt;code&gt;autovacuum_enabled=off&lt;/code&gt;, inserted 10000 rows and deleted 5000, so the table holds 5000 dead tuples that nothing will clean. Values belong to this capture only.&lt;/p&gt;</description></item><item><title>archive: WAL archiving</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/archive/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/archive/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. No fault was injected. The primary&amp;rsquo;s WAL archiving was already failing in the lab (its &lt;code&gt;archive_command&lt;/code&gt; runs &lt;code&gt;sys_rman archive-push&lt;/code&gt;, and the last success was 21 days earlier), so the WARN below is what the lab really looks like; why it fails was not investigated for this page, because kbdiag does not read the server log. Values belong to this capture only.&lt;/p&gt;</description></item><item><title>params: changed parameters</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/params/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/params/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The WARN example was created by an injection script: it changed &lt;code&gt;max_files_per_process&lt;/code&gt; (a parameter that needs a restart) with &lt;code&gt;ALTER SYSTEM&lt;/code&gt;, reloaded the configuration, and did not restart, so the running value differs from the file. Values belong to this capture only.&lt;/p&gt;</description></item><item><title>repl: replication from this node</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/repl/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/repl/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The WARN example was created by a fault-injection script that pauses the standby&amp;rsquo;s WAL receiver (SIGSTOP), the same one used on the &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/slots/"&gt;&lt;code&gt;slots&lt;/code&gt;&lt;/a&gt; page. Values belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-898c044a-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-898c044a-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag repl [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;No options of its own. Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>cluster: repmgr's view</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/cluster/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/cluster/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The cluster is managed by repmgr, with its metadata in database &lt;code&gt;esrep&lt;/code&gt;. The WARN example was created by the fault-injection script that pauses the standby&amp;rsquo;s WAL receiver (SIGSTOP) until the standby is no longer attached to the primary, the same one used on the &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/slots/"&gt;&lt;code&gt;slots&lt;/code&gt;&lt;/a&gt; page. Values belong to this capture only.&lt;/p&gt;</description></item><item><title>top-objects: largest tables and indexes</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/top-objects/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/top-objects/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. Nothing was injected. Values belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-ba3c3054-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-ba3c3054-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag top-objects [--limit N] [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-table-scroll td-table-scroll--static"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th scope="col"&gt;Option&lt;/th&gt;&#10; &lt;th scope="col"&gt;Effect&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--limit N&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;Show at most N rows per list; default 20, &lt;code&gt;0&lt;/code&gt; for all&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--json&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;Print JSON&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt; and it looks at the database you are connected to. This command only shows; it has no findings.&lt;/p&gt;</description></item><item><title>table: one table</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/table/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/table/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. Two WARN/OK examples were created by injection scripts: &lt;code&gt;public.kbdiag_inj_dead&lt;/code&gt; (table with &lt;code&gt;autovacuum_enabled=off&lt;/code&gt;, 10000 rows inserted and 5000 deleted) and &lt;code&gt;public.kbdiag_inj_tbl&lt;/code&gt; (20000 rows inserted, 5000 deleted, with a primary key and a second index). Values belong to this capture only.&lt;/p&gt;</description></item><item><title>top: cumulative top SQL</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/top/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/top/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. Nothing was injected. In the lab &lt;code&gt;sys_stat_statements.track&lt;/code&gt; is &lt;code&gt;none&lt;/code&gt; on both nodes, so statements are not being collected and &lt;code&gt;top&lt;/code&gt; has no rows to show. This page shows that case, which is what the lab really looks like. The case with statistics on was not captured (see the last section).&lt;/p&gt;</description></item><item><title>progress: long operations</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/progress/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/progress/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The running example was created by an injection script that ran &lt;code&gt;CREATE INDEX&lt;/code&gt; on &lt;code&gt;public.orders&lt;/code&gt; (1,000,000 rows) and was read three times while it ran, once by &lt;code&gt;kbdiag_ro&lt;/code&gt;. PIDs and timings belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-63c3f0dd-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-63c3f0dd-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag progress [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;No options of its own. Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>checkpoint: checkpoint activity</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/checkpoint/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/checkpoint/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. Nothing was injected. Values belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-6384a185-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-6384a185-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag checkpoint [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;No options of its own. Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="primary"&gt;Primary&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-6384a185-fence-1" data-td-code data-td-code-auto-id&#10; data-td-language="bash" data-td-line-count="2"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-6384a185-fence-1-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/kbdiag checkpoint&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;EXIT_CODE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-6384a185-fence-2" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="21"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-6384a185-fence-2-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;checkpoint OK (KingbaseES V008R006C009B0014, primary, system@local, 2026-10-07T17:20:59+08:00)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;last checkpoint&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; time 2026-10-07 17:18:33 (2m 26s ago)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; redo 0/C651C548 (0000000300000000000000C6)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;since the statistics reset 2026-09-15 23:12:34 (21d 18h ago)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; checkpoints 1606: 1606 timed, 0 requested (0%; requested covers WAL volume, CHECKPOINT, base backups, promotion)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; write, sync time 6m 54s, 490 ms&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; buffers written 17029: checkpointer 10565 (62%), bgwriter 0 (0%), backends and others 6464 (38%)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; buffers allocated 37300&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; backend fsyncs 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; bgwriter stopped 0 times at bgwriter_lru_maxpages&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;settings&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; checkpoint_timeout 5m 0s&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; max_wal_size 1024 MB&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; checkpoint_completion_target 0.5&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; checkpoint_warning 30s&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; log_checkpoints on&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;EXIT_CODE=0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;last checkpoint&lt;/code&gt; is the time and the &lt;code&gt;redo&lt;/code&gt; position (with its WAL file) of the latest checkpoint.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;checkpoints&lt;/code&gt; counts timed and requested checkpoints since the statistics reset. &amp;ldquo;Requested&amp;rdquo; is not only WAL volume: a manual &lt;code&gt;CHECKPOINT&lt;/code&gt;, a base backup (including a repmgr clone), a promotion, and creating or dropping a database count too. kbdiag gives the share but draws no conclusion. The server&amp;rsquo;s own &amp;ldquo;checkpoints too frequent&amp;rdquo; warning looks at the interval between two checkpoints (&lt;code&gt;checkpoint_warning&lt;/code&gt;), which cumulative counters cannot give.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;buffers written&lt;/code&gt; splits dirty-buffer writes into three: the checkpointer, the background writer, and &amp;ldquo;backends and others&amp;rdquo;. The third is not &amp;ldquo;the checkpointer cannot keep up&amp;rdquo;: in PG12 &lt;code&gt;buffers_backend&lt;/code&gt; also counts relation extension, the ring buffers of VACUUM and COPY, and the standby&amp;rsquo;s startup process, so an idle node can show 60-70% there (65% and 70% were measured in this lab).&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;backend fsyncs&lt;/code&gt; above 0 is shown, not reported as a WARN. It means an fsync request could not be handed to the checkpointer, which happens when the queue is full or the checkpointer was not running at that moment (9 was measured earlier on this lab&amp;rsquo;s node2, which kbha had restarted).&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;settings&lt;/code&gt; is the relevant parameters.&lt;/li&gt;&#10;&lt;li&gt;Display only, so any probe that is not collected makes the verdict UNKNOWN; OK means &amp;ldquo;all collected&amp;rdquo;, not &amp;ldquo;good numbers&amp;rdquo;.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="standby"&gt;Standby&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-6384a185-fence-3" data-td-code data-td-code-auto-id&#10; data-td-language="bash" data-td-line-count="2"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-6384a185-fence-3-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/kbdiag checkpoint&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;EXIT_CODE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-6384a185-fence-4" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="21"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-6384a185-fence-4-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;checkpoint OK (KingbaseES V008R006C009B0014, standby, system@local, 2026-10-07T17:21:06+08:00)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;checkpoint record the last restartpoint started from (written by the primary)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; time 2026-10-07 17:18:33 (2m 33s ago)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; redo 0/C651C548 (0000000300000000000000C6)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;since the statistics reset 2026-10-07 16:49:26 (31m 40s ago)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; checkpoints 43 timed, 0 requested restartpoint attempts (a standby counts every try, one every 15s while no new checkpoint record has arrived)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; write, sync time 2m 51s, 26 ms&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; buffers written 45117: checkpointer 7496 (17%), bgwriter 0 (0%), backends and others 37621 (83%)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; buffers allocated 38458&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; backend fsyncs 1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; bgwriter stopped 0 times at bgwriter_lru_maxpages&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;settings&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; checkpoint_timeout 5m 0s&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; max_wal_size 1024 MB&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; checkpoint_completion_target 0.5&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; checkpoint_warning 30s&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; log_checkpoints on&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;EXIT_CODE=0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;On a standby these are not restartpoint counts. In PG12 the checkpointer adds one for every attempt, and with no new checkpoint record it tries every 15 seconds (over four days that was 15917 attempts on this lab&amp;rsquo;s node2), so the text says &lt;code&gt;restartpoint attempts&lt;/code&gt; and gives no ratio.&lt;/li&gt;&#10;&lt;li&gt;The header says the checkpoint record the last restartpoint started from was written by the primary: the time is the primary&amp;rsquo;s.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="exit-codes"&gt;Exit codes&#10;&lt;/h2&gt;&#10;&lt;div class="td-table-scroll td-table-scroll--static"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th scope="col"&gt;Code&lt;/th&gt;&#10; &lt;th scope="col"&gt;Meaning&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;0&lt;/td&gt;&#10; &lt;td&gt;OK&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;3&lt;/td&gt;&#10; &lt;td&gt;UNKNOWN: data not collected or not visible&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;64&lt;/td&gt;&#10; &lt;td&gt;Usage error&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;69&lt;/td&gt;&#10; &lt;td&gt;Cannot connect&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;&lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/"&gt;Back to the manual&lt;/a&gt;&lt;/p&gt;</description></item><item><title>wal: WAL position and what keeps it</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/wal/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/wal/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. Nothing was injected. Values belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-0b8ce340-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-0b8ce340-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag wal [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;No options of its own. Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="primary"&gt;Primary&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-0b8ce340-fence-1" data-td-code data-td-code-auto-id&#10; data-td-language="bash" data-td-line-count="2"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-0b8ce340-fence-1-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/kbdiag wal&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;EXIT_CODE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-0b8ce340-fence-2" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="14"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-0b8ce340-fence-2-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wal OK (KingbaseES V008R006C009B0014, primary, system@local, 2026-10-07T17:20:59+08:00)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;position&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; lsn 0/C9352468&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; file 0000000300000000000000C9&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sys_wal: 214 files, 3248 MB&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;what keeps WAL here&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; max_wal_size 1024 MB&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; wal_keep_segments 8192 MB (512 x 16 MB)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; slot repmgr_slot_2 0 bytes (active)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; archiving 38 .ready files waiting (kbdiag archive)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;EXIT_CODE=0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;position&lt;/code&gt; is the current write position and its WAL file.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;sys_wal&lt;/code&gt; is the same size as on &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/space/"&gt;&lt;code&gt;space&lt;/code&gt;&lt;/a&gt;: same probe, same columns.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;what keeps WAL here&lt;/code&gt; puts on one screen what you would otherwise assemble from three commands: the parameters (&lt;code&gt;max_wal_size&lt;/code&gt;, &lt;code&gt;wal_keep_segments&lt;/code&gt; as its size), each replication slot with the WAL it retains and whether it is active, and the archive backlog. Here the slot retains 0 bytes and is active, but 38 &lt;code&gt;.ready&lt;/code&gt; files wait for archiving (the lab&amp;rsquo;s archiving is failing, see &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/archive/"&gt;&lt;code&gt;archive&lt;/code&gt;&lt;/a&gt;).&lt;/li&gt;&#10;&lt;li&gt;It shows and does not repeat the judgment. An inactive slot is reported by &lt;code&gt;kbdiag slots&lt;/code&gt; and a failing archive by &lt;code&gt;kbdiag archive&lt;/code&gt;; this screen only points there. The same problem reported in three commands would look like three problems.&lt;/li&gt;&#10;&lt;li&gt;The WAL generation rate needs two samples over time; a single query cannot give it, so this version does not.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="standby"&gt;Standby&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-0b8ce340-fence-3" data-td-code data-td-code-auto-id&#10; data-td-language="bash" data-td-line-count="2"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-0b8ce340-fence-3-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/kbdiag wal&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;EXIT_CODE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-0b8ce340-fence-4" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="13"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-0b8ce340-fence-4-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wal OK (KingbaseES V008R006C009B0014, standby, system@local, 2026-10-07T17:21:06+08:00)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;position&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; replayed 0/C9352A80&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sys_wal: 198 files, 3136 MB&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;what keeps WAL here&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; max_wal_size 1024 MB&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; wal_keep_segments 8192 MB (512 x 16 MB)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; slots none&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; archiving 0 .ready files waiting&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;EXIT_CODE=0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;On a standby &lt;code&gt;position&lt;/code&gt; is the replay position (there is no write position, and no WAL file name). This standby has no slots of its own, and nothing waits for archiving.&lt;/p&gt;</description></item><item><title>seq: sequences</title><link>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/seq/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/seq/</guid><description>&lt;p&gt;Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database &lt;code&gt;test&lt;/code&gt;, using &lt;code&gt;~/kbdiag&lt;/code&gt; built from Go source commit &lt;code&gt;96c874f&lt;/code&gt; (static linux/amd64 binary). This is lab evidence, not production validation. The FAIL example was created by an injection script: it created &lt;code&gt;public.kbdiag_inj_seq&lt;/code&gt; with &lt;code&gt;maxvalue 3&lt;/code&gt; and used it up with &lt;code&gt;nextval&lt;/code&gt;. Values belong to this capture only.&lt;/p&gt;&#10;&lt;h2 id="usage"&gt;Usage&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-aabdad56-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="text" data-td-line-count="1"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-aabdad56-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kbdiag seq [--limit N] [--json]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div class="td-table-scroll td-table-scroll--static"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th scope="col"&gt;Option&lt;/th&gt;&#10; &lt;th scope="col"&gt;Effect&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--limit N&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;Show at most N sequences; default 20, &lt;code&gt;0&lt;/code&gt; for all&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;&lt;code&gt;--json&lt;/code&gt;&lt;/td&gt;&#10; &lt;td&gt;Print JSON&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&#10;&lt;p&gt;Connection options are the same as for &lt;a href="https://kevin-wenyu.github.io/kbdiag-docs/docs/reference/sessions/"&gt;&lt;code&gt;sessions&lt;/code&gt;&lt;/a&gt; and it looks at the database you are connected to. &lt;code&gt;--limit&lt;/code&gt; only trims the list; the finding covers every sequence.&lt;/p&gt;</description></item></channel></rss>