Re: why memoize is not used for correlated subquery

Поиск
Список
Период
Сортировка
От Andy Fan
Тема Re: why memoize is not used for correlated subquery
Дата
Msg-id 87cyp6s1qw.fsf@163.com
обсуждение исходный текст
Ответ на Re: why memoize is not used for correlated subquery  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers

> I imagined making this work by delaying the plan creation for
> subqueries until the same time as create_plan() for the outer query.

Do you mean sublinks rather than subqueries? if so, we can get another
benefit I want very much.

explain (costs off) select * from t1 where t1.a = 1
                    and exists (select 1 from t2 where  t2.a = t1.a and random() > 0);
                              QUERY PLAN                               
-----------------------------------------------------------------------
 Seq Scan on t1
   Filter: ((a = 1) AND EXISTS(SubPlan 1))
   SubPlan 1
     ->  Seq Scan on t2
           Filter: ((a = t1.a) AND (random() > '0'::double precision))

As for now, when we are planing the sublinks, we don't know t1.a = 1
which may lost some optimization chance.  Considering the t2.a is a
partition key of t2, this would yield some big improvement for planning
a big number of partitioned table.

-- 
Best Regards
Andy Fan




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andy Fan
Дата:
Сообщение: Re: Parallel CREATE INDEX for GIN indexes
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: ON ERROR in json_query and the like