Re: BUG #15233: Error in estimation leads to very bad parralel plan in simple 2 table join.

From: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Maxim Boguk <mb(at)dataegret(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15233: Error in estimation leads to very bad parralel plan in simple 2 table join.
Date: 2018-06-08 12:08:43
Message-ID: CAK-MWwRh=J70OTJYtct-j=RV2BmPtq4bhMzgPtwN4Vc0ygBcxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> > Planning time: 2.953 ms
> > Execution time: 2084537.882 ms
> >
> > Problem with estimation of selectivity
> > -> Seq Scan on area a (cost=0.00..265.70 rows=1 width=106) (actual
> > time=0.669..1.756 rows=23 loops=1)
> >
> ​​
> Filter: ((path)::text ~~ '%.1806.%'::text)
> > leads to very dangerous idea to perform nested loop with very heavy
> parallel
> > plan inside.
> >
>
> Is it because you have not performed Analyze on the 'area' or is it
> something else due to which there is such a deviation in estimation?
>
>
>
​Hi,​

I don't think there is good way estimate selectivity of

Filter: ((path)::text ~~ '%.1806.%'::text)

But problem that there huge difference in real plan cost with exactly 1 row
vs 2 or more rows estimated. Problem still exists without parallel plan
involved, where is leads to 23 seq scan over table with 100M rows :(.

--
Maxim Boguk
Senior Postgresql DBA
http://dataegret.com/ <http://www.postgresql-consulting.com/>

Phone RU: +7 985 433 0000
Phone UA: +380 99 143 0000
Phone AU: +61 45 218 5678

LinkedIn: http://www.linkedin.com/pub/maksym-boguk/80/b99/b1b
Skype: maxim.boguk

"Доктор, вы мне советовали так не делать, но почему мне по-прежнему больно
когда я так делаю ещё раз?"

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2018-06-09 05:06:05 Re: BUG #15225: [XX000] ERROR: invalid DSA memory alloc request size 1073741824 / Where: parallel worker
Previous Message Amit Kapila 2018-06-08 07:47:01 Re: BUG #15233: Error in estimation leads to very bad parralel plan in simple 2 table join.