Re: Erroneous cost estimation for nested loop join - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Erroneous cost estimation for nested loop join
Date
Msg-id CANP8+jLvenWYmYn6Kck6dQ-FgfAhMg1cbL9eZjFGeQ7L=jhT6Q@mail.gmail.com
Whole thread Raw
In response to Erroneous cost estimation for nested loop join  (kawamichi@tkl.iis.u-tokyo.ac.jp)
Responses Re: Erroneous cost estimation for nested loop join
Re: Erroneous cost estimation for nested loop join
List pgsql-hackers
On 9 November 2015 at 10:08, <kawamichi@tkl.iis.u-tokyo.ac.jp> wrote:

We guessed the cause of this error would be in the cost model of Postgres, and investigated the source code of optimizer, and we found the cause of this problem. It was in the index cost estimation process. On scanning inner table, if loop count is greater than 1, its I/O cost is counted as random access. In the case of Query2, in one loop (i.e. one inner table scan) , much data is read sequentially with clustered index, so it seems to be wrong that optimizer thinks its I/O workload is random access.

We don't have a clustered index in Postgres. We do store correlation stats for the index, which is used in some places to reduce cost.

Could you look some more at this and see if a model change that uses the correlation can improve this? 

--
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

pgsql-hackers by date:

Previous
From: Gavin Flower
Date:
Subject: Re: Erroneous cost estimation for nested loop join
Next
From: Ashutosh Bapat
Date:
Subject: Re: Transactions involving multiple postgres foreign servers