Unify "In" Sublink to EXIST Sublink for better optimize opportunity

Поиск
Список
Период
Сортировка
От Andy Fan
Тема Unify "In" Sublink to EXIST Sublink for better optimize opportunity
Дата
Msg-id CAKU4AWqu=fZNX9zKh_ES-xjX3Om0J_aiJ9WhBCS8MrJcKvn=0A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Unify "In" Sublink to EXIST Sublink for better optimize opportunity  (Andy Fan <zhihui.fan1213@gmail.com>)
Список pgsql-hackers

Due to the implementation of convert_ANY_sublink_to_join,  we have
limitations below, which has been discussed at [1] [2].

    if (contain_vars_of_level((Node *) subselect, 1))
        return NULL; 

I'm thinking if we can do the ${subject}. If so,  the query like

SELECT * FROM t1 WHERE 
a IN (SELECT * FROM t2 WHERE t2.b > t1.b);

can be converted to

SELECT * FROM t1 WHERE 
EXISTS (SELECT * FROM t2 WHERE t2.b > t1.b AND t1.a = t2.a);

Then the sublink can be removed with existing logic (the NOT-IN format
will not be touched since they have different meanings). 

Any ideas? 


--
Best Regards
Andy Fan

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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: hash_xlog_split_allocate_page: failed to acquire cleanup lock
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: shadow variables - pg15 edition