Re: Preferring index-only-scan when the cost is equal

2018-07-13 Thread Yugo Nagata
On Thu, 12 Jul 2018 12:59:15 +0200 Tomas Vondra wrote: > > > On 07/12/2018 03:44 AM, Yugo Nagata wrote: > > On Wed, 11 Jul 2018 14:37:46 +0200 > > Tomas Vondra wrote: > > > >> > >> On 07/11/2018 01:28 PM, Ashutosh Bapat wrote: > > > >>> I don't think we should change add_path() for this. We

Re: Preferring index-only-scan when the cost is equal

2018-07-12 Thread Tomas Vondra
On 07/12/2018 03:44 AM, Yugo Nagata wrote: On Wed, 11 Jul 2018 14:37:46 +0200 Tomas Vondra wrote: On 07/11/2018 01:28 PM, Ashutosh Bapat wrote: I don't think we should change add_path() for this. We will unnecessarily check that condition even for the cases where we do not create index

Re: Preferring index-only-scan when the cost is equal

2018-07-11 Thread Yugo Nagata
On Wed, 11 Jul 2018 14:37:46 +0200 Tomas Vondra wrote: > > On 07/11/2018 01:28 PM, Ashutosh Bapat wrote: > > I don't think we should change add_path() for this. We will > > unnecessarily check that condition even for the cases where we do not > > create index paths. I think we should fix the ca

Re: Preferring index-only-scan when the cost is equal

2018-07-11 Thread Tomas Vondra
On 07/11/2018 01:28 PM, Ashutosh Bapat wrote: On Wed, Jul 11, 2018 at 11:03 AM, Yugo Nagata wrote: Hi, I found that there is a situation that even when index only scan can be effective, the planner doesn't select this. The planner makes indexe paths in descending order of indexrelid, and t

Re: Preferring index-only-scan when the cost is equal

2018-07-11 Thread Ashutosh Bapat
On Wed, Jul 11, 2018 at 11:03 AM, Yugo Nagata wrote: > Hi, > > I found that there is a situation that even when index only scan can be > effective, > the planner doesn't select this. The planner makes indexe paths in descending > order of indexrelid, and the new path is discarded if its cost is

Preferring index-only-scan when the cost is equal

2018-07-10 Thread Yugo Nagata
Hi, I found that there is a situation that even when index only scan can be effective, the planner doesn't select this. The planner makes indexe paths in descending order of indexrelid, and the new path is discarded if its cost is not less than the existing paths' cost. As a result, IndexOnlySc