rows 里估算值(reltuples)旁边是统计里的活元组和死元组。xid age 是冻结年龄,对照 autovacuum_freeze_max_age。
vacuum and analyze:死元组对照 autovacuum 触发线,最近手工和自动的 vacuum、analyze 各多久前、几次,以及上次 analyze 之后的修改数。
access since the statistics reset:扫描、读写的行数、块缓存命中,命中率保留一位小数,几次读盘不会被四舍五入成 100%。
indexes 有大小、扫描次数、是不是主键和定义。
判定复用别的命令的规则,没有新规则:年龄对照和 freeze 同样的两条线(finding id 是 freeze.table_age),表级关了 autovacuum 又过线是 vacuum.table_disabled。这里两条都没触发,所以是 OK。
同一张表在备库上
~/kbdiag table orders
echoEXIT_CODE=$?
table OK (KingbaseES V008R006C009B0014, standby, system@local, 2026-10-07T17:21:04+08:00)
public.orders (table)
size 170 MB (heap 62 MB, indexes 108 MB, no TOAST)
rows 1000000 estimated
xid age 994 (autovacuum_freeze_max_age 200000000)
mxid age 0
reloptions -
statistics: not_applicable (standby: table statistics are local to each node and stay 0 here; run on the primary)
indexes: 3
name size scans kind definition
idx_orders_user_status 30 MB - - CREATE INDEX idx_orders_user_status ON public.orders USING btree (user_id, status)
kbdiag_rev_idx 56 MB - - CREATE INDEX kbdiag_rev_idx ON public.orders USING btree (md5((id)::text))
orders_pkey 22 MB - primary key CREATE UNIQUE INDEX orders_pkey ON public.orders USING btree (id)
EXIT_CODE=0
table WARN (KingbaseES V008R006C009B0014, primary, system@local, 2026-10-07T17:21:13+08:00)
[WARN] vacuum.table_disabled table public.kbdiag_inj_dead has 5000 dead tuples, past its autovacuum threshold 2050, but autovacuum is off for it (autovacuum_enabled=off): nothing will clean it
fix: VACUUM public.kbdiag_inj_dead # connected to database test; turn autovacuum back on with ALTER TABLE ... RESET (autovacuum_enabled) unless it was turned off on purpose
public.kbdiag_inj_dead (table)
size 712 kB (heap 704 kB, indexes 0 bytes, TOAST 8192 bytes)
rows 10000 estimated; 5000 live, 5000 dead
xid age 4 (autovacuum_freeze_max_age 200000000)
mxid age 0
reloptions autovacuum_enabled=off
vacuum and analyze
dead tuples 5000, autovacuum threshold 2050: due (autovacuum is off for this table)
last vacuum never (0 times)
last autovacuum never (0 times)
last analyze 1s ago (1 time)
last autoanalyze never (0 times)
modified since analyze 5000
access since the statistics reset
seq scans 1 (10000 rows read)
index scans -
rows written 10000 inserted, 0 updated (0 HOT), 5000 deleted
heap blocks 87 read, 15335 hit (99.4% hit)
index blocks -
indexes: 0
EXIT_CODE=1
finding 和 kbdiag vacuum 对这张表报的是同一条:vacuum.table_disabled,fix 也一样。reloptions 里能看到原因 autovacuum_enabled=off,文本写 due (autovacuum is off for this table)。
modified since analyze 是 5000,和删掉的 5000 行对得上。
过了线但 autovacuum 开着
~/kbdiag table kbdiag_inj_tbl
echoEXIT_CODE=$?
table OK (KingbaseES V008R006C009B0014, primary, system@local, 2026-10-07T17:21:18+08:00)
public.kbdiag_inj_tbl (table)
size 2504 kB (heap 1520 kB, indexes 976 kB, TOAST 8192 bytes)
rows 20000 estimated; 15000 live, 5000 dead
xid age 5 (autovacuum_freeze_max_age 200000000)
mxid age 0
reloptions -
vacuum and analyze
dead tuples 5000, autovacuum threshold 4050: due
last vacuum never (0 times)
last autovacuum never (0 times)
last analyze 1s ago (1 time)
last autoanalyze never (0 times)
modified since analyze 5000
access since the statistics reset
seq scans 3 (20000 rows read)
index scans 0 (0 rows fetched)
rows written 20000 inserted, 0 updated (0 HOT), 5000 deleted
heap blocks 189 read, 25743 hit (99.2% hit)
index blocks 122 read, 79374 hit (99.8% hit)
indexes: 2
name size scans kind definition
kbdiag_inj_tbl_n 520 kB 0 - CREATE INDEX kbdiag_inj_tbl_n ON public.kbdiag_inj_tbl USING btree (n)
kbdiag_inj_tbl_pkey 456 kB 0 primary key CREATE UNIQUE INDEX kbdiag_inj_tbl_pkey ON public.kbdiag_inj_tbl USING btree (id)
EXIT_CODE=0
kbdiag: no table "no_such_table" in database "test" (unquoted names fold to lower case; quote them as in SQL: '"Name"'; use -d for another database)
table UNKNOWN (KingbaseES V008R006C009B0014, primary, system@local, 2026-10-07T17:21:19+08:00)
table: not found
EXIT_CODE=3
第一行是 stderr,说明不带引号的名字会折成小写,以及用 -d 选别的库。退出码 3(UNKNOWN),报告正文只有 table: not found。