Merge Left Join (cost=207646.00..213864.12 rows=347851 width=62) (actual time=30922.366..32166.518 rows=13908 loops=1) Merge Cond: ("outer".name = "inner".name) -> Sort (cost=6.71..7.03 rows=127 width=30) (actual time=1.117..1.207 rows=100 loops=1) Sort Key: log.name -> Seq Scan on log_example_3 log (cost=0.00..2.27 rows=127 width=30) (actual time=0.053..0.177 rows=100 loops=1) -> Sort (cost=207639.29..209008.78 rows=547796 width=32) (actual time=30921.171..31467.117 rows=442848 loops=1) Sort Key: uh.name -> Subquery Scan uh (cost=111447.90..118295.35 rows=547796 width=32) (actual time=19277.963..21595.874 rows=547796 loops=1) -> Sort (cost=111447.90..112817.39 rows=547796 width=32) (actual time=19277.908..20104.568 rows=547796 loops=1) Sort Key: name -> Seq Scan on user_history (cost=0.00..22103.96 rows=547796 width=32) (actual time=0.051..1474.143 rows=547796 loops=1)