On 2018/12/10 0:57, Amit Langote wrote:
> On Sun, Dec 9, 2018 at 8:13 PM David Rowley
> <[email protected]> wrote:
>> listp1 was scanned twice (loops=2), listp2 was scanned just once.
>>
>> Now it is true that if the subplan was executed 0 times that it will
>> appear as "(never executed)", but do we really need to explain in this
>> area that "(never executed)" means loops=0?
>
> Ah, I see what you mean. So, "(never executed)" is not the only sign
> of of run-time pruning occurring. The value of loops can be different
> for different subplans / partitions, and it being lower for a given
> subplan means that the subplan has been pruned more number of times.
I updated the patch. Regarding whether we should mention "(never
executed)", it wouldn't hurt to mention it imho, exactly because it's
shown in the place of showing loops=0. How about the attached?
Thanks,
Amit
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 1925ff4550..0d9353fc3b 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -4421,8 +4421,12 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate
>= DATE '2008-01-01';
query, partition pruning is performed whenever one of the
execution parameters being used by partition pruning changes.
Determining if partitions were pruned during this phase requires
- careful inspection of the <literal>nloops</literal> property in
- the <command>EXPLAIN ANALYZE</command> output.
+ careful inspection of the <literal>loops</literal> property in
+ the <command>EXPLAIN ANALYZE</command> output. Subplans corresponding
+ to different partitions may have different values for it depending on
+ how many times each of them was pruned during execution. Some may be
+ shown as <literal>(never executed)</literal> if they were pruned every
+ time.
</para>
</listitem>
</itemizedlist>