@@ -560,84 +560,91 @@ CREATE TABLE some_table AS SELECT generate_series(1, 100) AS VAL;
560560 <listitem>
561561 <para>
562562 <emphasis role="strong"><literal>id = (select ... limit 1)</literal></emphasis>
563- plpgsql EXPLAIN (COSTS OFF, ANALYZE) SELECT * FROM
564- partitioned_table WHERE id = (SELECT * FROM some_table LIMIT
565- 1); QUERY PLAN
566- ----------------------------------------------------------------------------------------------------
567- Custom Scan (RuntimeAppend) (actual time=0.030..0.033 rows=1
568- loops=1) InitPlan 1 (returns $0) -> Limit (actual
569- time=0.011..0.011 rows=1 loops=1) -> Seq Scan on some_table
570- (actual time=0.010..0.010 rows=1 loops=1) -> Seq Scan on
571- partitioned_table_70 partitioned_table (actual
572- time=0.004..0.006 rows=1 loops=1) Filter: (id = $0) Rows
573- Removed by Filter: 9 Planning time: 1.131 ms Execution time:
574- 0.075 ms (9 rows)
575- </para>
576- </listitem>
577- </itemizedlist>
578- <para>
579- /* disable RuntimeAppend node */ SET
580- pg_pathman.enable_runtimeappend = f;
581- </para>
582- <para>
583- EXPLAIN (COSTS OFF, ANALYZE) SELECT * FROM partitioned_table WHERE
584- id = (SELECT * FROM some_table LIMIT 1); QUERY PLAN
585- ----------------------------------------------------------------------------------
586- Append (actual time=0.196..0.274 rows=1 loops=1) InitPlan 1
587- (returns $0) -> Limit (actual time=0.005..0.005 rows=1 loops=1)
588- -> Seq Scan on some_table (actual time=0.003..0.003 rows=1
589- loops=1) -> Seq Scan on partitioned_table_0 (actual
590- time=0.014..0.014 rows=0 loops=1) Filter: (id = $0) Rows Removed
591- by Filter: 6 -> Seq Scan on partitioned_table_1 (actual
592- time=0.003..0.003 rows=0 loops=1) Filter: (id = $0) Rows Removed
593- by Filter: 5 ... /* more plans follow */ Planning time: 1.140 ms
594- Execution time: 0.855 ms (306 rows)
563+ <programlisting>
564+ plpgsql
565+ EXPLAIN (COSTS OFF, ANALYZE) SELECT * FROM partitioned_table
566+ WHERE id = (SELECT * FROM some_table LIMIT 1);
567+ QUERY PLAN
568+ ----------------------------------------------------------------------------------------------------
569+ Custom Scan (RuntimeAppend) (actual time=0.030..0.033 rows=1 loops=1)
570+ InitPlan 1 (returns $0)
571+ -> Limit (actual time=0.011..0.011 rows=1 loops=1)
572+ -> Seq Scan on some_table (actual time=0.010..0.010 rows=1 loops=1)
573+ -> Seq Scan on partitioned_table_70 partitioned_table (actual time=0.004..0.006 rows=1 loops=1)
574+ Filter: (id = $0)
575+ Rows Removed by Filter: 9
576+ Planning time: 1.131 ms
577+ Execution time: 0.075 ms
578+ (9 rows)
579+
580+ /* disable RuntimeAppend node */
581+ SET pg_pathman.enable_runtimeappend = f;
582+
583+ EXPLAIN (COSTS OFF, ANALYZE) SELECT * FROM partitioned_table
584+ WHERE id = (SELECT * FROM some_table LIMIT 1);
585+ QUERY PLAN
586+ ----------------------------------------------------------------------------------
587+ Append (actual time=0.196..0.274 rows=1 loops=1)
588+ InitPlan 1 (returns $0)
589+ -> Limit (actual time=0.005..0.005 rows=1 loops=1)
590+ -> Seq Scan on some_table (actual time=0.003..0.003 rows=1 loops=1)
591+ -> Seq Scan on partitioned_table_0 (actual time=0.014..0.014 rows=0 loops=1)
592+ Filter: (id = $0)
593+ Rows Removed by Filter: 6
594+ -> Seq Scan on partitioned_table_1 (actual time=0.003..0.003 rows=0 loops=1)
595+ Filter: (id = $0)
596+ Rows Removed by Filter: 5
597+ ... /* more plans follow */
598+ Planning time: 1.140 ms
599+ Execution time: 0.855 ms
600+ (306 rows)
601+ </programlisting>
595602 </para>
596603 <itemizedlist spacing="compact">
597604 <listitem>
598605 <para>
599606 <emphasis role="strong"><literal>id = ANY (select ...)</literal></emphasis>
600- plpgsql EXPLAIN (COSTS OFF, ANALYZE) SELECT * FROM
601- partitioned_table WHERE id = any (SELECT * FROM some_table
602- limit 4); QUERY PLAN
603- -----------------------------------------------------------------------------------------------------------
604- Nested Loop (actual time=0.025..0.060 rows=4 loops=1) ->
605- Limit (actual time=0.009..0.011 rows=4 loops=1) -> Seq Scan
606- on some_table (actual time=0.008 ..0.010 rows=4 loops=1) ->
607- Custom Scan (RuntimeAppend) ( actual time=0.002 ..0.004 rows=1
608- loops=4) -> Seq Scan onpartitioned_table_70
609- partitioned_table (actual time=0.001 ..0.001 rows=10 loops=1 )
610- -> Seq Scan onpartitioned_table_26 partitioned_table
611- (actual time=0.002..0.003 rows=9 loops=1) -> Seq Scan on
612- partitioned_table_27 partitioned_table (actual
613- time=0.001..0.002 rows=20 loops=1) -> Seq Scan on
614- partitioned_table_63 partitioned_table (actual
615- time=0.001..0.002 rows=9 loops=1) Planning time : 0.771 ms
616- Execution time: 0.101 ms (10 rows)
617- </para>
618- </listitem>
619- </itemizedlist>
620- <para>
621- /* disable RuntimeAppend node */ SET
622- pg_pathman.enable_runtimeappend = f ;
623- </para>
624- <para>
625- EXPLAIN (COSTS OFF, ANALYZE) SELECT * FROM partitioned_table WHERE
626- id =any (SELECT * FROM some_table limit 4); QUERY PLAN
627- -----------------------------------------------------------------------------------------
628- Nested Loop Semi Join (actual time=0.531..1.526 rows=4 loops=1)
629- Join Filter: ( partitioned_table.id = some_table.val) Rows Removed
630- by Join Filter: 3990 ->Append (actual time=0.190 ..0.470
631- rows=1000 loops=1) -> Seq Scan onpartitioned_table (actual
632- time=0.187 ..0.187 rows=0 loops=1) -> Seq Scan on
633- partitioned_table_0 (actual time=0.002..0.004 rows=6 loops=1)
634- ->Seq Scan on partitioned_table_1 (actual time=0.001 ..0.001
635- rows=5 loops=1) ->Seq Scan on partitioned_table_2 (actual
636- time=0.002 ..0.004 rows=14 loops=1) ... /* 96 scans follow */ ->
637- Materialize (actual time=0.000..0.000 rows=4 loops=1000) ->
638- Limit (actual time=0.005..0.006 rows=4 loops=1) -> Seq Scan on
639- some_table (actual time=0.003..0.004 rows=4 loops=1) Planning
640- time: 2.169 ms Execution time: 2.059 ms (110 rows)
607+ <programlisting>
608+ plpgsql
609+ EXPLAIN (COSTS OFF, ANALYZE) SELECT * FROM partitioned_table
610+ WHERE id = any (SELECT * FROM some_table limit 4);
611+ QUERY PLAN
612+ -----------------------------------------------------------------------------------------------------------
613+ Nested Loop (actual time=0.025 ..0.060 rows=4 loops=1)
614+ -> Limit ( actual time=0.009 ..0.011 rows=4 loops=1)
615+ -> Seq Scan onsome_table (actual time=0.008..0.010 rows=4 loops=1)
616+ -> Custom Scan (RuntimeAppend) (actual time=0.002 ..0.004 rows=1 loops=4 )
617+ -> Seq Scan onpartitioned_table_70 partitioned_table (actual time=0.001..0.001 rows=10 loops=1)
618+ -> Seq Scan on partitioned_table_26 partitioned_table (actual time=0.002..0.003 rows=9 loops=1)
619+ -> Seq Scan on partitioned_table_27 partitioned_table (actual time=0.001..0.002 rows=20 loops=1)
620+ -> Seq Scan on partitioned_table_63 partitioned_table (actual time=0.001..0.002 rows=9 loops=1)
621+ Planning time: 0.771 ms
622+ Execution time: 0.101 ms
623+ (10 rows)
624+
625+ /* disable RuntimeAppend node */
626+ SET pg_pathman.enable_runtimeappend = f;
627+
628+ EXPLAIN (COSTS OFF, ANALYZE) SELECT * FROM partitioned_table
629+ WHERE id = any (SELECT * FROM some_table limit 4) ;
630+ QUERY PLAN
631+ -----------------------------------------------------------------------------------------
632+ Nested Loop Semi Join (actual time=0.531..1.526 rows=4 loops=1)
633+ Join Filter: (partitioned_table. id = some_table.val)
634+ Rows Removed by Join Filter: 3990
635+ -> Append (actual time=0.190..0.470 rows=1000 loops=1)
636+ -> Seq Scan on partitioned_table (actual time=0.187..0.187 rows=0 loops=1)
637+ -> Seq Scan on partitioned_table_0 (actual time=0.002 ..0.004 rows=6 loops=1)
638+ -> Seq Scan onpartitioned_table_1 (actual time=0.001..0.001 rows=5 loops=1)
639+ -> Seq Scan on partitioned_table_2 (actual time=0.002 ..0.004 rows=14 loops=1)
640+ ... /* 96 scans follow */
641+ -> Materialize (actual time=0.000 ..0.000 rows=4 loops=1000)
642+ -> Limit (actual time=0.005..0.006 rows=4 loops=1)
643+ -> Seq Scan on some_table (actual time=0.003 ..0.004 rows=4 loops=1)
644+ Planning time: 2.169 ms
645+ Execution time: 2.059 ms
646+ (110 rows)
647+ </programlisting>
641648 </para>
642649 <itemizedlist spacing="compact">
643650 <listitem>