Re: [HACKERS] Quals not pushed down into lateral

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [HACKERS] Quals not pushed down into lateral
Дата
Msg-id 20170413203907.fxtugl72drtmahzc@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: [HACKERS] Quals not pushed down into lateral  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [HACKERS] Quals not pushed down into lateral
Список pgsql-hackers
On 2017-04-13 16:34:12 -0400, Robert Haas wrote:
> On Thu, Mar 16, 2017 at 4:45 AM, Andres Freund <andres@anarazel.de> wrote:
> > During citus development we noticed that restrictions aren't pushed down
> > into lateral subqueries, even if they semantically could.  For example,
> > in this dumbed down example:
> >
> > postgres[31776][1]=# CREATE TABLE t_2(id serial primary key);
> > postgres[31776][1]=# CREATE TABLE t_1(id serial primary key);
> >
> > Comparing:
> >
> > postgres[31776][1]=# EXPLAIN SELECT * FROM t_1 JOIN (SELECT * FROM t_2 GROUP BY id) s ON (t_1.id = s.id) WHERE
t_1.id= 3;
 
> > postgres[31776][1]=# EXPLAIN SELECT * FROM t_1, LATERAL (SELECT * FROM t_2 WHERE t_1.id = t_2.id GROUP BY id) s
WHEREt_1.id = 3;
 
> 
> Interesting.  That does seem like we are missing a trick.

Yea.

> Not exactly related, but I think we need to improve optimization
> around CTEs, too.  AFAICT, what we've got right now, almost everybody
> hates.

That's certainly an issue, but it's a lot harder to resolve because
we've, for years, told people to intentionally use CTEs as optimization
barriers :(

- Andres



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Quals not pushed down into lateral
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] [POC] hash partitioning