@@ -729,11 +729,9 @@ WHERE t1.unique1 < 10 AND t1.unique2 = t2.unique2;
729729 Buffers: shared hit=3 read=5 written=4
730730 -> Bitmap Index Scan on tenk1_unique1 (cost=0.00..4.36 rows=10 width=0) (actual time=0.004..0.004 rows=10.00 loops=1)
731731 Index Cond: (unique1 < 10)
732- Index Searches: 1
733732 Buffers: shared hit=2
734733 -> Index Scan using tenk2_unique2 on tenk2 t2 (cost=0.29..7.90 rows=1 width=244) (actual time=0.003..0.003 rows=1 loops=10)
735734 Index Cond: (unique2 = t1.unique2)
736- Index Searches: 10
737735 Buffers: shared hit=24 read=6
738736 Planning:
739737 Buffers: shared hit=15 dirtied=9
@@ -792,7 +790,6 @@ WHERE t1.unique1 < 100 AND t1.unique2 = t2.unique2 ORDER BY t1.fivethous;
792790 Buffers: shared hit=92
793791 -> Bitmap Index Scan on tenk1_unique1 (cost=0.00..5.04 rows=100 width=0) (actual time=0.013..0.013 rows=100.00 loops=1)
794792 Index Cond: (unique1 < 100)
795- Index Searches: 1
796793 Buffers: shared hit=2
797794 Planning:
798795 Buffers: shared hit=12
@@ -808,58 +805,6 @@ WHERE t1.unique1 < 100 AND t1.unique2 = t2.unique2 ORDER BY t1.fivethous;
808805 shown.)
809806 </para>
810807
811- <para>
812- Index Scan nodes (as well as Bitmap Index Scan and Index-Only Scan nodes)
813- show an <quote>Index Searches</quote> line that reports the total number
814- of searches across <emphasis>all</emphasis> node
815- executions/<literal>loops</literal>:
816-
817- <screen>
818- EXPLAIN ANALYZE SELECT * FROM tenk1 WHERE thousand IN (1, 500, 700, 999);
819- QUERY PLAN
820- -------------------------------------------------------------------&zwsp;---------------------------------------------------------
821- Bitmap Heap Scan on tenk1 (cost=9.45..73.44 rows=40 width=244) (actual time=0.012..0.028 rows=40.00 loops=1)
822- Recheck Cond: (thousand = ANY ('{1,500,700,999}'::integer[]))
823- Heap Blocks: exact=39
824- Buffers: shared hit=47
825- -> Bitmap Index Scan on tenk1_thous_tenthous (cost=0.00..9.44 rows=40 width=0) (actual time=0.009..0.009 rows=40.00 loops=1)
826- Index Cond: (thousand = ANY ('{1,500,700,999}'::integer[]))
827- Index Searches: 4
828- Buffers: shared hit=8
829- Planning Time: 0.037 ms
830- Execution Time: 0.034 ms
831- </screen>
832-
833- Here we see a Bitmap Index Scan node that needed 4 separate index
834- searches. The scan had to search the index from the
835- <structname>tenk1_thous_tenthous</structname> index root page once per
836- <type>integer</type> value from the predicate's <literal>IN</literal>
837- construct. However, the number of index searches often won't have such a
838- simple correspondence to the query predicate:
839-
840- <screen>
841- EXPLAIN ANALYZE SELECT * FROM tenk1 WHERE thousand IN (1, 2, 3, 4);
842- QUERY PLAN
843- ----------------------------------------------------------------------------------------------------------------------------------
844- Bitmap Heap Scan on tenk1 (cost=9.45..73.44 rows=40 width=244) (actual time=0.009..0.019 rows=40.00 loops=1)
845- Recheck Cond: (thousand = ANY ('{1,2,3,4}'::integer[]))
846- Heap Blocks: exact=38
847- Buffers: shared hit=40
848- -> Bitmap Index Scan on tenk1_thous_tenthous (cost=0.00..9.44 rows=40 width=0) (actual time=0.005..0.005 rows=40.00 loops=1)
849- Index Cond: (thousand = ANY ('{1,2,3,4}'::integer[]))
850- Index Searches: 1
851- Buffers: shared hit=2
852- Planning Time: 0.029 ms
853- Execution Time: 0.026 ms
854- </screen>
855-
856- This variant of our <literal>IN</literal> query performed only 1 index
857- search. It spent less time traversing the index (compared to the original
858- query) because its <literal>IN</literal> construct uses values matching
859- index tuples stored next to each other, on the same
860- <structname>tenk1_thous_tenthous</structname> index leaf page.
861- </para>
862-
863808 <para>
864809 Another type of extra information is the number of rows removed by a
865810 filter condition:
@@ -916,7 +861,6 @@ EXPLAIN ANALYZE SELECT * FROM polygon_tbl WHERE f1 @> polygon '(0.5,2.0)';
916861 Index Scan using gpolygonind on polygon_tbl (cost=0.13..8.15 rows=1 width=85) (actual time=0.074..0.074 rows=0.00 loops=1)
917862 Index Cond: (f1 @> '((0.5,2))'::polygon)
918863 Rows Removed by Index Recheck: 1
919- Index Searches: 1
920864 Buffers: shared hit=1
921865 Planning Time: 0.039 ms
922866 Execution Time: 0.098 ms
@@ -950,10 +894,8 @@ EXPLAIN (ANALYZE, BUFFERS OFF) SELECT * FROM tenk1 WHERE unique1 < 100 AND un
950894 -> BitmapAnd (cost=25.07..25.07 rows=10 width=0) (actual time=0.100..0.101 rows=0.00 loops=1)
951895 -> Bitmap Index Scan on tenk1_unique1 (cost=0.00..5.04 rows=100 width=0) (actual time=0.027..0.027 rows=100.00 loops=1)
952896 Index Cond: (unique1 < 100)
953- Index Searches: 1
954897 -> Bitmap Index Scan on tenk1_unique2 (cost=0.00..19.78 rows=999 width=0) (actual time=0.070..0.070 rows=999.00 loops=1)
955898 Index Cond: (unique2 > 9000)
956- Index Searches: 1
957899 Planning Time: 0.162 ms
958900 Execution Time: 0.143 ms
959901</screen>
@@ -981,7 +923,6 @@ EXPLAIN ANALYZE UPDATE tenk1 SET hundred = hundred + 1 WHERE unique1 < 100;
981923 Buffers: shared hit=4 read=2
982924 -> Bitmap Index Scan on tenk1_unique1 (cost=0.00..5.04 rows=100 width=0) (actual time=0.031..0.031 rows=100.00 loops=1)
983925 Index Cond: (unique1 < 100)
984- Index Searches: 1
985926 Buffers: shared read=2
986927 Planning Time: 0.151 ms
987928 Execution Time: 1.856 ms
@@ -1120,7 +1061,6 @@ EXPLAIN ANALYZE SELECT * FROM tenk1 WHERE unique1 < 100 AND unique2 > 9000
11201061 Index Cond: (unique2 > 9000)
11211062 Filter: (unique1 < 100)
11221063 Rows Removed by Filter: 287
1123- Index Searches: 1
11241064 Buffers: shared hit=16
11251065 Planning Time: 0.077 ms
11261066 Execution Time: 0.086 ms
0 commit comments