select * FROM pg_statio_user_tables?
точно нет и relid одинаковый
Покажите. Казалось бы, тогда там дубли в pg_class. Дело в том, что основа этого view примерно такая: SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, t.relname AS toast_name FROM pg_class AS c LEFT JOIN pg_class AS t ON c.reltoastrelid = t.oid LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace;
SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid) AS heap_blks_read, pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, sum(pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))::bigint AS idx_blks_read, sum(pg_stat_get_blocks_hit(i.indexrelid))::bigint AS idx_blks_hit, pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid) AS toast_blks_read, pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, pg_stat_get_blocks_fetched(x.indexrelid) - pg_stat_get_blocks_hit(x.indexrelid) AS tidx_blks_read, pg_stat_get_blocks_hit(x.indexrelid) AS tidx_blks_hit FROM pg_class c LEFT JOIN pg_index i ON c.oid = i.indrelid LEFT JOIN pg_class t ON c.reltoastrelid = t.oid LEFT JOIN pg_index x ON t.oid = x.indrelid LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"]) GROUP BY c.oid, n.nspname, c.relname, t.oid, x.indexrelid; Буду смотреть
Хмм... а из какой это версии? Потому что в v15: CREATE OR REPLACE VIEW pg_catalog.pg_statio_all_tables AS SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid) AS heap_blks_read, pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, i.idx_blks_read, i.idx_blks_hit, pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid) AS toast_blks_read, pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, x.idx_blks_read AS tidx_blks_read, x.idx_blks_hit AS tidx_blks_hit FROM pg_class c LEFT JOIN pg_class t ON c.reltoastrelid = t.oid LEFT JOIN pg_namespace n ON n.oid = c.relnamespace LEFT JOIN LATERAL ( SELECT sum(pg_stat_get_blocks_fetched(pg_index.indexrelid) - pg_stat_get_blocks_hit(pg_index.indexrelid))::bigint AS idx_blks_read, sum(pg_stat_get_blocks_hit(pg_index.indexrelid))::bigint AS idx_blks_hit FROM pg_index WHERE pg_index.indrelid = c.oid) i ON true LEFT JOIN LATERAL ( SELECT sum(pg_stat_get_blocks_fetched(pg_index.indexrelid) - pg_stat_get_blocks_hit(pg_index.indexrelid))::bigint AS idx_blks_read, sum(pg_stat_get_blocks_hit(pg_index.indexrelid))::bigint AS idx_blks_hit FROM pg_index WHERE pg_index.indrelid = t.oid) x ON true WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char", 'm'::"char"])
А это точно не fork (тогда причём тут PostgreSQL, по большому счёту)? ;)
В ванильном 14 -- тожэ как он говорит, это в 15 переделали на LATERAL JOIN. Впрочем, проблема, скорее всего именно в форке и его переделанном тостере. Несложно заметить, что оно принцыпиально завязано на то, что у toast-таблицы ровно один индэкс.
Пинайте поддержку cloudsql -- это явно их баг какой-то (возможно, не тот, что я указал).
Обсуждают сегодня