pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Erik Wienhold <ewie@ewie.name>
To: Loles <lolesft@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: No problem, only curiosity
Date: Tue, 24 Jan 2023 14:51:55 +0100 (CET)
Message-ID: <2014960602.121600.1674568315040@office.mailbox.org> (raw )
In-Reply-To: <CA+FWGK6U4RfPZqE=1RMTwU8ezqhJp8NBGuf_pErLF-RbtJ_FNA@mail.gmail.com >
References: <CA+FWGK6U4RfPZqE=1RMTwU8ezqhJp8NBGuf_pErLF-RbtJ_FNA@mail.gmail.com >
> On 24/01/2023 14:06 CET Loles <lolesft@gmail.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
view thread (3+ messages) latest in thread
Message-ID: <2014960602.121600.1674568315040@office.mailbox.org>
Permalink: ../2014960602.121600.1674568315040@office.mailbox.org/
Also on: postgresql.org/message-id/2014960602.121600.1674568315040@office.mailbox.org
copy link · copy postgr.es
reply 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: ewie@ewie.name, lolesft@gmail.com
Subject: Re: No problem, only curiosity
In-Reply-To: <2014960602.121600.1674568315040@office.mailbox.org>
* 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