neondatabase / neon

Neon: Serverless Postgres. We separated storage and compute to offer autoscaling, code-like database branching, and scale to zero.
https://neon.tech
Apache License 2.0
14.78k stars 429 forks source link

pg_stat_progress_vacuum almost useless in Neon due to missing privileges #6686

Closed Bodobolero closed 8 months ago

Bodobolero commented 8 months ago

Steps to reproduce

Run the following in E-2-E environment (not locally). The problem only shows if we use a role derived from neon_superuser which is not Postgres superuser.

DDL

DROP TABLE pgbench_accounts;
CREATE TABLE pgbench_accounts (
    aid bigint NOT NULL,
    bid integer,
    abalance integer,
    filler character(84),
    -- create more blocks more quickly to make sure auto-vacuum has something to do
    text_column_plain TEXT  DEFAULT repeat('NeonIsCool', 5),
    jsonb_column_extended JSONB  DEFAULT ('{ "tell everyone": [' || repeat('{"Neon": "IsCool"},',9) || ' {"Neon": "IsCool"}]}')::jsonb
)
WITH (fillfactor='100');

DML

\! date
insert into pgbench_accounts(aid,bid,abalance,filler) select aid, (aid - 1) / 100000 + 1, 0, '' from generate_series(1, 20000000) as aid;
\! date

Monitor auto-vacuum

\! date
SELECT pid, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, 
       index_vacuum_count, max_dead_tuples, num_dead_tuples
FROM pg_stat_progress_vacuum;

Expected result

you see values for all columns

Actual result

you only see values for column pid:

neondb=> \! date
Thu Feb  8 11:07:39 CET 2024
neondb=> SELECT pid, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, 
neondb->        index_vacuum_count, max_dead_tuples, num_dead_tuples
neondb-> FROM pg_stat_progress_vacuum;
 pid  | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples 
------+-------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
 2984 |       |                 |                   |                    |                    |                 |                
(1 row)

Environment

E-2-E (staging)

Logs, links

Bodobolero commented 8 months ago

This should be resolved when https://github.com/neondatabase/neon/pull/6691 is merged

andreasscherbaum commented 7 months ago

It's released