Re: possible optimizations - pushing filter before aggregation
| От | Mithun Cy |
|---|---|
| Тема | Re: possible optimizations - pushing filter before aggregation |
| Дата | |
| Msg-id | CAD__OuhP04+=mn0DGOytpVM_g_qWWGwJCG8DXnoJSAkhMCVk0w@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: possible optimizations - pushing filter before aggregation (Pavel Stehule <pavel.stehule@gmail.com>) |
| Ответы |
Re: possible optimizations - pushing filter before aggregation
|
| Список | pgsql-hackers |
On Sat, Nov 19, 2016 at 8:59 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
SELECT MIN(a) m FROM(SELECT a FROM t WHERE a=2) AS v(a)The subquery is going to return an intermediate result of:V:A---2And the minimum of that is 2, which is the wrong answer.yes, you have true,
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",
If both are given we can combine them appropriately.
В списке pgsql-hackers по дате отправления: