From: Teja Jakkidi <teja.jakkidi05@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: N_live_tup value is less than actual row count in a table
Date: Fri, 10 Jun 2022 13:23:26 -0700
Message-ID: <D93AF3EA-7668-4FFD-87F4-211982B76C17@gmail.com> (raw)
Hello PGSQL Admin group,
I am noticing this wierd behavior and not sure if this is how Postgres actually works.
I have a test table with 100000 rows and I deleted 20000 rows. So the current rows are 80000 and dead tuples should be 20000. After autovacuum completed, the dead tuples were gone.
When querying the pg_stat_all_tables, it returned n_live_tup value as 63945. Why is it less than actual row count 80000?
I read some articles and it is suggested to analyze manually to bring that n_live_tup number to actual row count. And it did work. After manual analyze, the n_live_tup is showing as 80000.
I am having hard time understanding why is this behavior and if there is something internally that is happening which I am missing. Please help me understand.
Thanks,
Teja.=
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: teja.jakkidi05@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: N_live_tup value is less than actual row count in a table
In-Reply-To: <D93AF3EA-7668-4FFD-87F4-211982B76C17@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox