Re: [HACKERS] strange plan with bitmap heap scan and multiple partial indexes

2015-07-11 Thread Tomas Vondra
Hi, On 07/11/2015 11:40 PM, Tom Lane wrote: Tomas Vondra writes: So I think the predicate proofing is a better approach, but of course the planning cost may be an issue. But maybe we can make this cheaper by some clever tricks? For example, given two predicates A and B, it seems that if A => B

Re: [HACKERS] strange plan with bitmap heap scan and multiple partial indexes

2015-07-11 Thread Tom Lane
Tomas Vondra writes: > So I think the predicate proofing is a better approach, but of course > the planning cost may be an issue. But maybe we can make this cheaper by > some clever tricks? For example, given two predicates A and B, it seems > that if A => B, then selectivity(A) <= selectivity(

Re: [HACKERS] strange plan with bitmap heap scan and multiple partial indexes

2015-07-11 Thread Tomas Vondra
On 07/11/2015 06:32 PM, Tom Lane wrote: ... Presumably, this is happening because the numbers of rows actually satisfying the index predicates are so small that it's a matter of luck whether any of them are included in ANALYZE's sample. Given this bad data for the index sizes, it's not totally

Re: [HACKERS] strange plan with bitmap heap scan and multiple partial indexes

2015-07-11 Thread Tom Lane
Andres Freund writes: > On 2015-07-11 14:31:25 +0200, Tomas Vondra wrote: >> While working on the "IOS with partial indexes" patch, I've noticed a bit >> strange plan. It's unrelated to that particular patch (reproducible on >> master), so I'm starting a new thread for it. > It's indeed interesti

Re: [HACKERS] strange plan with bitmap heap scan and multiple partial indexes

2015-07-11 Thread Andres Freund
On 2015-07-11 14:31:25 +0200, Tomas Vondra wrote: > While working on the "IOS with partial indexes" patch, I've noticed a bit > strange plan. It's unrelated to that particular patch (reproducible on > master), so I'm starting a new thread for it. > > To reproduce it, all you have to do is this (on

[HACKERS] strange plan with bitmap heap scan and multiple partial indexes

2015-07-11 Thread Tomas Vondra
Hi, While working on the "IOS with partial indexes" patch, I've noticed a bit strange plan. It's unrelated to that particular patch (reproducible on master), so I'm starting a new thread for it. To reproduce it, all you have to do is this (on a new cluster, all settings on default): CREA