Re: possible optimizations - pushing filter before aggregation - Mailing list pgsql-hackers

From Douglas Doole
Subject Re: possible optimizations - pushing filter before aggregation
Date
Msg-id CADE5jYJWtT_mD_ZO5ajZFFn1aZk_v+cv=p2s2bT-Zw=X8iRvAA@mail.gmail.com
Whole thread Raw
In response to Re: possible optimizations - pushing filter before aggregation  (Mithun Cy <mithun.cy@enterprisedb.com>)
Responses Re: possible optimizations - pushing filter before aggregation
List pgsql-hackers
In above case wondering if we could do this

Min(a) = 2 is the condition, generate condition "a <= 2" and push it down as scan key. Since pushed down condition is lossy one for us ( it gives values < 2), finally do a recheck of "Min(a) = 2".

For Max(a) = 2 we can have "a >=2",

After replying, I was thinking along these lines too. I can't see any reason why it wouldn't work. The same would apply for HAVING clauses on min/max aggregations as well.

For min, you should be able to pre-filter =, < , and <=. In all cases the pre-filter would be <=. For max it would be =, > , >= becoming >=.

- Doug Doole
Salesforce

pgsql-hackers by date:

Previous
From: Gilles Darold
Date:
Subject: Re: Patch to implement pg_current_logfile() function
Next
From: Michael Paquier
Date:
Subject: Re: [sqlsmith] Crash on GUC serialization