Re: Incorrect choice of Nested Loop for a skewed distribution

2019-09-05 Thread Oleg Kharin
Thank you Justin! On Wed, 04 Sep 2019 17:18:36 -0700 (PDT), Justin Pryzby wrote: When you dropped the index, you necessarily refused the plan involving index scan. So it did merge join instead (which it thinks of as expensive because it has to sort both sides). As you saw, the rowcount estima

Re: Incorrect choice of Nested Loop for a skewed distribution

2019-09-04 Thread Justin Pryzby
On Tue, Sep 03, 2019 at 09:47:42PM +0400, Oleg Kharin wrote: > Hi All, > > With PostgreSQL 10 and 11, the planner doesn't use the lists of most common > values to determine the selectivity of "=" for Nested Loop as it does for a > normal inner join in eqjoinsel_inner(). Incorrect choice of a neste

Incorrect choice of Nested Loop for a skewed distribution

2019-09-03 Thread Oleg Kharin
Hi All, With PostgreSQL 10 and 11, the planner doesn't use the lists of most common values to determine the selectivity of "=" for Nested Loop as it does for a normal inner join in eqjoinsel_inner(). Incorrect choice of a nested loops join strategy causes poor query performance. To demonstrat