How does the planner determine plan_rows ?

From: Donald Dong <xdong(at)csumb(dot)edu>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: How does the planner determine plan_rows ?
Date: 2019-01-11 02:41:46
Message-ID: 9BFB8B01-6E2B-4F65-A9B5-299BCB69A1C0@csumb.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I created some empty tables and run ` EXPLAIN ANALYZE` on `SELECT * `. I found
the results have different row numbers, but the tables are all empty.

=# CREATE TABLE t1(id INT, data INT);
=# EXPLAIN ANALYZE SELECT * FROM t1;
Seq Scan on t1 (cost=0.00..32.60 rows=2260 width=8) (actual
time=0.003..0.003 rows=0 loops=1)

=# CREATE TABLE t2(data VARCHAR);
=# EXPLAIN ANALYZE SELECT * FROM t2;
Seq Scan on t2 (cost=0.00..23.60 rows=1360 width=32) (actual
time=0.002..0.002 rows=0 loops=1)

=# CREATE TABLE t3(id INT, data VARCHAR);
=# EXPLAIN ANALYZE SELECT * FROM t3;
Seq Scan on t3 (cost=0.00..22.70 rows=1270 width=36) (actual
time=0.001..0.001 rows=0 loops=1)

I found this behavior unexpected. I'm still trying to find out how/where the planner
determines the plan_rows. Any help will be appreciated!

Thank you,
Donald Dong

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-01-11 03:35:53 Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query
Previous Message Andrew Gierth 2019-01-11 02:40:25 Re: Ryu floating point output patch