Itagaki Takahiro <itagaki.takahiro@gmail.com> writes:
> I found an explicit UNION ALL has higher cost than an automatic expansion
> by inheritance (49 vs. 83 in the example below). Where does the difference
> come from?
The plan for UNION initially involves a couple of SubqueryScan nodes,
which impose an extra cost of cpu_tuple_cost per tuple. Those later
get optimized away, but we don't try to readjust the cost estimates
for that.
regards, tom lane