Re: No problem, only curiosity

From: Loles <lolesft(at)gmail(dot)com>
To: Erik Wienhold <ewie(at)ewie(dot)name>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: No problem, only curiosity
Date: 2023-01-24 13:55:40
Message-ID: CA+FWGK64hYdp7oqN=ZB9n9tH-bsiua_pJK_K3iggFo_f9pvzuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Oh yes.. sorry and thank you.

El mar, 24 ene 2023 a las 14:51, Erik Wienhold (<ewie(at)ewie(dot)name>) escribió:

> > On 24/01/2023 14:06 CET Loles <lolesft(at)gmail(dot)com> wrote:
> >
> > Does anyone know why I am getting a result less than 2 million rows in
> this
> > example?
> >
> > postgres=# create table test_n_tup_live (id serial);
> > CREATE TABLE
> >
> > postgres=# insert into test_n_tup_live select generate_series(1,1000000);
> > INSERT 0 1000000
> >
> > postgres=# analyze test_n_tup_live ;
> > ANALYZE
> >
> > postgres=# select n_live_tup, n_dead_tup from pg_stat_user_tables where
> relname = 'test_n_tup_live';
> >
> > n_live_tup | n_dead_tup
> > ------------+------------
> > 1000000 | 0
> > (1 fila)
> >
> > postgres=# update test_n_tup_live set id = id + 1;
> > UPDATE 1000000
> >
> > postgres=# insert into test_n_tup_live select generate_series(1,1000000);
> > INSERT 0 1000000
> >
> > postgres=# select n_live_tup, n_dead_tup from pg_stat_user_tables where
> relname = 'test_n_tup_live';
> > n_live_tup | n_dead_tup
> > ------------+------------
> > 2000000 | 1000000
> > (1 fila)
> >
> > postgres=# vacuum test_n_tup_live;
> > VACUUM
> >
> > postgres=# select n_live_tup, n_dead_tup from pg_stat_user_tables where
> relname = 'test_n_tup_live';
> >
> > n_live_tup | n_dead_tup
> > ------------+------------
> > 1999925 | 0
> > (1 fila)
>
> Both numbers are estimates:
> https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW
>
> --
> Erik
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message jagjit singh 2023-01-24 19:15:05 Reg: Load balacing and HA requirement.
Previous Message Erik Wienhold 2023-01-24 13:51:55 Re: No problem, only curiosity