Re: [HACKERS] Generalizing range-constraint detection in clauselist_selectivity

2012-09-28 Thread Josh Berkus
On 9/28/12 5:13 PM, Tom Lane wrote: > We could probably eliminate that inconsistency by insisting that two > clauses can only be matched for this purpose when they reference the > same set of rels overall, but that doesn't feel right --- it certainly > seems like the example above ought to be thoug

Re: [HACKERS] Generalizing range-constraint detection in clauselist_selectivity

2012-09-28 Thread Tom Lane
Josh Berkus writes: >> I'm thinking that this is overly restrictive, and we could usefully >> suppose that "var >= anything" and "var <= anything" should be treated >> as a range constraint pair if the vars match and there are no volatile >> functions in the expressions. We are only trying to get

Re: [HACKERS] Generalizing range-constraint detection in clauselist_selectivity

2012-09-28 Thread Josh Berkus
> I'm thinking that this is overly restrictive, and we could usefully > suppose that "var >= anything" and "var <= anything" should be treated > as a range constraint pair if the vars match and there are no volatile > functions in the expressions. We are only trying to get a selectivity > estimat

[HACKERS] Generalizing range-constraint detection in clauselist_selectivity

2012-09-28 Thread Tom Lane
Over in pgsql-performance, Shaun Thomas was just complaining about the planner not picking a bitmap indexscan for a query involving a constraint like b.created_dt between a.created_dt and a.created_dt + interval '1 month'; At first I wrote this off as being due to inability to ge