| От | Tom Lane |
|---|---|
| Тема | Re: nested loop joins |
| Дата | |
| Msg-id | 110341.1635274572@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | nested loop joins (Greg Rychlewski <greg.rychlewski@gmail.com>) |
| Список | pgsql-novice |
Greg Rychlewski <greg.rychlewski@gmail.com> writes:
> I'm looking to understand how nested loop joins with limits work. Say I
> have this query
> SELECT *
> FROM a INNER JOIN b ON a.id = b.id
> LIMIT 10;
> Say this was done as a nested loop join where the rows of "a" are the outer
> loop.
> In this scenario, would all the rows of "a" be materialized or are they
> lazily evaluated?
Evaluation of the join will stop as soon as it's produced 10 rows.
Only as much of "a" will be read as necessary to get that.
(Potentially, not all of "b" would be read either, if 10 matches
to the first "a" row exist in "b".)
regards, tom lane
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера