How does the planner determine plan_rows ? - Mailing list pgsql-hackers

From Donald Dong
Subject How does the planner determine plan_rows ?
Date
Msg-id 9BFB8B01-6E2B-4F65-A9B5-299BCB69A1C0@csumb.edu
Whole thread Raw
Responses Re: How does the planner determine plan_rows ?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: How does the planner determine plan_rows ?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Ryu floating point output patch
Next
From: Amit Kapila
Date:
Subject: Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query