Re: pg_stat_user_tables.n_tup_ins empty for partitioned table

From: Luca Ferrari <fluca1978(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_stat_user_tables.n_tup_ins empty for partitioned table
Date: 2019-05-24 07:19:51
Message-ID: CAKoxK+6T6TNTJkUBgYnAegkWuKSH2AzjtTUtAphSUJp1HFEn=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 22, 2019 at 7:55 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> That clearly seems wrong. Could you try build a small reproducer?

Apparently not, I've tried to simulate the same but without any
success, that is n_tup_ins is always correctly set.
However, I've noted that this behavior applies up to february

# select schemaname, relname, n_tup_ins, n_tup_upd, n_tup_del,
n_live_tup from pg_stat_user_tables where n_tup_ins = 0 and n_live_tup
> 0;
schemaname | relname | n_tup_ins | n_tup_upd | n_tup_del | n_live_tup
------------+----------+-----------+-----------+-----------+------------
spire | y2018m09 | 0 | 28961860 | 0 | 9708398
spire | y2018m10 | 0 | 29791202 | 0 | 14902436
spire | y2018m11 | 0 | 28191462 | 0 | 14086279
spire | y2018m12 | 0 | 29676478 | 0 | 14828806
spire | y2019m01 | 0 | 28769406 | 0 | 14381782
spire | y2019m02 | 0 | 27088208 | 0 | 13541677
spire | sensori | 0 | 892 | 0 | 446

now what I did change back then was to avoid a single INSERT...SELECT
statement and provide a FOR...SELECT loop with every single insert
within it. But I don't think this is the reason, could it be a restore
from a backup I don't remember?
Unluckily I cannot reproduce this behavior so far.
And I stand correct, the PostgreSQL version is 11.1:

# select version();
version
---------------------------------------------------------------------------------------------------------
PostgreSQL 11.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-28), 64-bit

Any idea is appreciated.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Rowley 2019-05-24 07:26:13 Re: pg_stat_user_tables.n_tup_ins empty for partitioned table
Previous Message Julie Nishimura 2019-05-24 07:00:45 Re: POSTGRES_FSM_RELATIONS CRITICAL: DB control fsm relations used: 79569 of 80000 (99%)