Re: No problem, only curiosity

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: No problem, only curiosity
Дата
Msg-id 2014960602.121600.1674568315040@office.mailbox.org
обсуждение исходный текст
Ответ на No problem, only curiosity  (Loles <lolesft@gmail.com>)
Ответы Re: No problem, only curiosity  (Loles <lolesft@gmail.com>)
Список pgsql-admin
> 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



В списке pgsql-admin по дате отправления:

Предыдущее
От: Loles
Дата:
Сообщение: No problem, only curiosity
Следующее
От: Loles
Дата:
Сообщение: Re: No problem, only curiosity