From: | Пантюшин Александр Иванович <AI(dot)Pantyushin(at)gaz-is(dot)ru> |
---|---|
To: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Тарасов Георгий Витальевич <Tarasov-G(at)gaz-is(dot)ru> |
Subject: | Re: Wrong rows count in EXPLAIN |
Date: | 2022-04-27 10:17:38 |
Message-ID: | 5cde2bfcd9a649ca98a5618564ff626e@gaz-is.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
>Which Postgres version do you use?
I checked this on PG 11
postgres=# select version();
version
-------------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11.5 on x86_64-w64-mingw32, compiled by x86_64-w64-mingw32-gcc.exe (x86_64-win32-seh-rev0, Built by MinGW-W64 project) 8.1.0, 64-bit
(1 row)
and on PG 13
postgres=# select version();
version
-----------------------------------------------------------------------------------------------------
PostgreSQL 13.5 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0, 64-bit
(1 row)
Both versions shows same strange rows counting in EXPLAINE
________________________________
От: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Отправлено: 27 апреля 2022 г. 13:08:22
Кому: Пантюшин Александр Иванович
Копия: pgsql-hackers(at)postgresql(dot)org; Тарасов Георгий Витальевич
Тема: Re: Wrong rows count in EXPLAIN
Hi!
> 26 апр. 2022 г., в 13:45, Пантюшин Александр Иванович <AI(dot)Pantyushin(at)gaz-is(dot)ru> написал(а):
>
> When I create a new table, and then I evaluate the execution of the SELECT query, I see a strange rows count in EXPLAIN
> CREATE TABLE test1(f INTEGER PRIMARY KEY NOT NULL);
> ANALYZE test1;
> EXPLAIN SELECT * FROM test1;
> QUERY PLAN
> ---------------------------------------------------------
> Seq Scan on test1 (cost=0.00..35.50 rows=2550 width=4)
> (1 row)
>
> Table is empty but rows=2550. Seem like it was calculated from some default values.
> Is this normal behavior or a bug? Can it lead to a poor choice of the plan of a query in general?
Which Postgres version do you use?
I observe:
postgres=# CREATE TABLE test1(f INTEGER PRIMARY KEY NOT NULL);
CREATE TABLE
postgres=# ANALYZE test1;
ANALYZE
postgres=# EXPLAIN SELECT * FROM test1;
QUERY PLAN
-----------------------------------------------------------------------------
Index Only Scan using test1_pkey on test1 (cost=0.12..8.14 rows=1 width=4)
(1 row)
postgres=# select version();
version
----------------------------------------------------------------------------------------------------------------------
PostgreSQL 15devel on x86_64-apple-darwin19.6.0, compiled by Apple clang version 11.0.3 (clang-1103.0.32.62), 64-bit
(1 row)
Without "ANALYZE test1;" table_block_relation_estimate_size() assumes relation size is 10 blocks.
Best regards, Andrey Borodin.
From | Date | Subject | |
---|---|---|---|
Next Message | Bharath Rupireddy | 2022-04-27 10:22:06 | Re: pgsql: Add contrib/pg_walinspect. |
Previous Message | houzj.fnst@fujitsu.com | 2022-04-27 10:08:12 | RE: bogus: logical replication rows/cols combinations |