测试多列DK的选择性问题(四)

2014-11-24 15:45:42 · 作者: · 浏览: 6
------------------------------------------------------------------------------------------------------------------------------------------------
Gather Motion 4:1 (slice1; segments: 4) (cost=1.02..4.12 rows=1 width=12)
Rows out: 4 rows at destination with 15 ms to first row, 27 ms to end, start offset by 29 ms.
-> Hash Join (cost=1.02..4.12 rows=1 width=12)
Hash Cond: t2.id = t1.id AND t2.name::text = t1.name::text
Rows out: Avg 1.3 rows x 3 workers. Max 2 rows (seg3) with 16 ms to first row, 23 ms to end, start offset by 344 ms.
Executor memory: 1K bytes avg, 1K bytes max (seg3).
Work_mem used: 1K bytes avg, 1K bytes max (seg3). Workfile: (0 spilling, 0 reused)
(seg0) Hash chain length 1.0 avg, 1 max, using 1 of 524341 buckets.
(seg3) Hash chain length 1.0 avg, 1 max, using 2 of 524341 buckets.
-> Seq Scan on gtt2 t2 (cost=0.00..3.04 rows=1 width=6)
Rows out: Avg 1.3 rows x 3 workers. Max 2 rows (seg3) with 0.186 ms to first row, 0.188 ms to end, start offset by 344 ms.
-> Hash (cost=1.01..1.01 rows=1 width=6)
Rows in: Avg 1.3 rows x 3 workers. Max 2 rows (seg3) with 0.706 ms to end, start offset by 359 ms.
-> Seq Scan on gtt1 t1 (cost=0.00..1.01 rows=1 width=6)
Rows out: Avg 1.3 rows x 3 workers. Max 2 rows (seg3) with 0.493 ms to first row, 0.499 ms to end, start offset by 359 ms.
Slice statistics:
(slice0) Executor memory: 184K bytes.
(slice1) Executor memory: 6333K bytes avg x 4 workers, 8385K bytes max (seg0). Work_mem: 1K bytes max.
Statement statistics:
Memory used: 128000K bytes
Total runtime: 56.840 ms
(21 rows)
gtlions=# explain analyze select * from gtt1 t1,gtt2 t2 where t1.id=t2.id and t1.name=t2.name and t1.id=11 and t1.name='b';
QUERY PLAN
-------------------------------------------------------------------------------------------------------
Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..4.11 rows=4 width=12)
Rows out: 1 rows at destination with 1.874 ms to end, start offset by 29 ms.
-> Nested Loop (cost=0.00..4.11 rows=1 width=12)
Rows out: 1 rows with 0.298 ms to first row, 0.305 ms to end, start offset by -313 ms.
-> Seq Scan on gtt1 t1 (cost=0.00..1.02 rows=1 width=6)
Filter: id = 11 AND name::text = 'b'::text AND 'b'::text = name::text AND 11 = id
Rows out: 1 rows with 0.187 ms to first row, 0.189 ms to end, start offset by -313 ms.
-> Seq Scan on gtt2 t2 (cost=0.00..3.08 rows=1 width=6)
Filter: 'b'::text = name::text AND 11 = id AND name::text = 'b'::text AND id = 11
Rows out: 1 rows with 0.037 ms to first row, 0.039 ms to end, start offset by -312 ms.
Slice statistics:
(slice0) Executor memory: 184K bytes.
(slice1) Executor memory: 202K bytes (seg2).
Statement statistics:
Memory used: 128000K bytes
Total runtime: 31.186 ms
(16 rows)


gtlions=# explain analyze select * from gtt1 t1,gtt2 t2 where t1.id=t2.id and t1.name=t2.name and t1.id=11 and t1.name='b' and t2.id=11 and t2.name='b';
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..4.08 rows=4 width=12)
Rows out: 1 rows at destination with 2.433 ms to first row, 2.434 ms to end, start offset by 32 ms.
-> Nested Loop (cost=0.00..4.08 rows=1 width=12)
Rows out: 1 rows with 0.270 ms to first row, 0.277 ms to end, start offset by -315 ms.
-> Seq Scan on gtt1 t1 (cost=0.00..1.01 rows=1 width=6)
Filter: id = 11 AND name::text = 'b'::text
Rows out: 1 rows with 0.183 ms to first row, 0.184 ms to end, start offset by -315 ms.
-> Seq Scan on gtt2 t2 (cost=0.0