Re: Double ocurring Subplan

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Double ocurring Subplan
Дата
Msg-id 5369.1305324136@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Double ocurring Subplan  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Ответы Re: Double ocurring Subplan
Список pgsql-hackers
Gurjeet Singh <singh.gurjeet@gmail.com> writes:
> I am listing the query, it's explain output and explain analyze output at
> the end.

> The EXPLAIN output shows the 'Subplan 2' node only once, whereas EXPLAIN
> ANALYZE output shows that the 'Subplan 2' is being executed twice . Is that
> true? Or is it just the plan printer getting confused? Is the confusion
> because of the 2 conditions in the WHERE clause of the correlated subquery?

The reason it looks like that is that the SubPlan is referenced in the
index condition, and there are actually two copies of that (indxqual and
indxqualorig).  They both point at the same physical subplan, but there
are two entries in the parent node's subPlan list.  In EXPLAIN you only
see one because ExecInitIndexScan skips initializing the indxquals in
EXPLAIN_ONLY mode.

In short: it's cosmetic.

We could probably suppress the duplicate printout when both references
are in the same plan node, but in bitmap scans the indxqual and
indxqualorig expressions are actually in different plan nodes (the
indexscan and heapscan respectively).  I'm not sure how we could
suppress the duplicate printout in that case, or whether it would even
make sense to do so --- after all, the subplan can in fact get called by
both nodes.
        regards, tom lane


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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Formatting Curmudgeons WAS: MMAP Buffers
Следующее
От: Cédric Villemain
Дата:
Сообщение: Re: the big picture for index-only scans