Re: n_live_tup number double after migration do PG 10.4

From: Mai Peng <maily(dot)peng(at)webedia-group(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Keith <keith(at)keithf4(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: n_live_tup number double after migration do PG 10.4
Date: 2018-08-07 07:38:16
Message-ID: 08D10E7A-A231-4B2E-8FBA-9096689A50D6@webedia-group.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,
The query I’m talking about is
SELECT schemaname, relname, sum(n_live_tup) AS n_live_tup, sum(n_dead_tup) AS n_dead_tup
FROM pg_stat_user_tables
GROUP BY schemaname, relname
ORDER BY n_live_tup DESC;

> Le 6 août 2018 à 06:24, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> a écrit :
>
> Keith <keith(at)keithf4(dot)com> writes:
>> On Sun, Aug 5, 2018 at 5:29 AM, Mai Peng <maily(dot)peng(at)webedia-group(dot)com>
>> wrote:
>>> After the migration to pg 10 by pg_upgrade and vacuumdb, I’ve seen the
>>> number of live tuple double and performance decreases on few queries.
>
>> The value stored in n_liv_tup is the value seen when the last analyze was
>> run on the table.
>
> No, you're confusing this with pg_class.reltuples. I think the OP is
> talking about pg_stat counters such as pg_stat_all_tables.n_live_tup.
> Those should update after every transaction, although there are various
> reasons why they might be inaccurate.
>
> The OP hasn't given us nearly enough information to speculate usefully
> on what he's seeing. I'd suggest reading
>
> https://wiki.postgresql.org/wiki/Guide_to_reporting_problems
>
> regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Cogan, Mark Contractor, NRL Code 3030 2018-08-09 21:05:04 pg_upgrade doesn't work?
Previous Message Dean Rasheed 2018-08-07 06:31:26 Re: Fwd: Problem with a "complex" upsert