数据重分布

最近更新时间: 2025-02-18 16:02:00

  • 复制
    复制成功
postgres=# explain select * from t3,t4 where t3.f1=t4.f2 and t4.f1=1;
                                         QUERY PLAN                                          
---------------------------------------------------------------------------------------------
 Remote Subquery Scan on all (dn001,dn002)  (cost=200.53..253.91 rows=1 width=16)
   ->  Hash Join  (cost=200.53..253.91 rows=1 width=16)
         Hash Cond: (t3.f1 = t4.f2)
         ->  Seq Scan on t3  (cost=0.00..44.00 rows=2500 width=8)
         ->  Hash  (cost=200.51..200.51 rows=1 width=8)
               ->  Remote Subquery Scan on all (dn001)  (cost=100.00..200.51 rows=1 width=8)
                     Distribute results by S: f2
                     ->  Seq Scan on t4  (cost=0.00..100.50 rows=1 width=8)
                           Filter: (f1 = 1)
(9 rows)
postgres=# explain select * from t3,t4 where t3.f2=t4.f2 and t4.f1=1; 
                                           QUERY PLAN                                           
------------------------------------------------------------------------------------------------
 Remote Subquery Scan on all (dn001,dn002)  (cost=300.53..386.41 rows=1 width=16)
   ->  Hash Join  (cost=300.53..386.41 rows=1 width=16)
         Hash Cond: (t3.f2 = t4.f2)
         ->  Remote Subquery Scan on all (dn001,dn002)  (cost=100.00..176.50 rows=2500 width=8)
               Distribute results by S: f2
               ->  Seq Scan on t3  (cost=0.00..44.00 rows=2500 width=8)
         ->  Hash  (cost=200.51..200.51 rows=1 width=8)
               ->  Remote Subquery Scan on all (dn001)  (cost=100.00..200.51 rows=1 width=8)
                     Distribute results by S: f2
                     ->  Seq Scan on t4  (cost=0.00..100.50 rows=1 width=8)
                           Filter: (f1 = 1)
(11 rows)