| От | Jay Levitt |
|---|---|
| Тема | Subquery in a JOIN not getting restricted? |
| Дата | |
| Msg-id | 4EB84CB4.2010102@gmail.com обсуждение исходный текст |
| Ответы |
Re: Subquery in a JOIN not getting restricted?
Re: Subquery in a JOIN not getting restricted? |
| Список | pgsql-performance |
When I run the following query:
select questions.id
from questions
join (
select u.id as user_id
from users as u
left join scores as s
on s.user_id = u.id
) as subquery
on subquery.user_id = questions.user_id;
the subquery is scanning my entire user table, even though it's restricted
by the outer query. (My real subquery is much more complicated, of course,
but this is the minimal fail case.)
Is this just not a thing the optimizer can do? Are there ways to rewrite
this, still as a subquery, that will be smart enough to only produce the one
row of subquery that matches questions.user_id?
Jay Levitt
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера