Different row estimations on base rels

From: Donald Dong <xdong(at)csumb(dot)edu>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Different row estimations on base rels
Date: 2019-05-26 17:00:18
Message-ID: C48F353B-A15F-4A69-A49D-38ADA6B8F131@csumb.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed the estimated rows of the base relations during the join
searching is *very* different from the estimations in the final plan.

Join search (rows of the initial_rels):
RELOPTINFO (ct): rows=1 width=4
RELOPTINFO (it): rows=1 width=4
RELOPTINFO (mc): rows=17567 width=32
RELOPTINFO (mi_idx): rows=1380035 width=8
RELOPTINFO (t): rows=2528356 width=25

The final plan:
Seq Scan on company_type ct
(cost=0.00..1.05 rows=1 width=4)
Seq Scan on info_type it
(cost=0.00..2.41 rows=1 width=4)
Parallel Seq Scan on movie_companies mc
(cost=0.00..37814.90 rows=7320 width=32)
Parallel Seq Scan on movie_info_idx mi_idx
(cost=0.00..13685.15 rows=575015 width=8)
Index Scan using title_pkey on title t
(cost=0.43..0.58 rows=1 width=25)

By looking at the joinrel->rows, I would expect relation t to have
the largest size, however, this is not true at all. I wonder what's
causing this observation, and how to get estimations close to the
final plan?

Thank you,
Donald Dong

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2019-05-26 20:21:49 Re: Fix typos for v12
Previous Message Alexander Lakhin 2019-05-26 15:43:41 Re: Fix typos for v12