Re: How does the planner determine plan_rows ?

2019-01-25 Thread Bruce Momjian
On Thu, Jan 10, 2019 at 11:41:51PM -0800, Donald Dong wrote: > > > On Jan 10, 2019, at 8:01 PM, Tom Lane wrote: > > > > ... estimate_rel_size() in plancat.c is where to look to find out > > about the planner's default estimates when it's lacking hard data. > > Thank you! Now I see how the

Re: How does the planner determine plan_rows ?

2019-01-10 Thread Donald Dong
> On Jan 10, 2019, at 8:01 PM, Tom Lane wrote: > > ... estimate_rel_size() in plancat.c is where to look to find out > about the planner's default estimates when it's lacking hard data. Thank you! Now I see how the planner uses the rows to estimate the cost and generates the best_plan. To

Re: How does the planner determine plan_rows ?

2019-01-10 Thread Tom Lane
Donald Dong writes: > 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. This isn't a terribly interesting case, since you've neither loaded any data nor vacuumed/analyzed the table, but ... > I

Re: How does the planner determine plan_rows ?

2019-01-10 Thread Donald Dong
Thank you for the great explanation! > On Jan 10, 2019, at 7:48 PM, Andrew Gierth > wrote: > >> "Donald" == Donald Dong writes: > > Donald> Hi, > Donald> I created some empty tables and run ` EXPLAIN ANALYZE` on > Donald> `SELECT * `. I found the results have different row numbers, >

Re: How does the planner determine plan_rows ?

2019-01-10 Thread Andrew Gierth
> "Donald" == Donald Dong writes: Donald> Hi, Donald> I created some empty tables and run ` EXPLAIN ANALYZE` on Donald> `SELECT * `. I found the results have different row numbers, Donald> but the tables are all empty. Empty tables are something of a special case, because the planner