Thank you Justin!
On Wed, 04 Sep 2019 17:18:36 -0700 (PDT), Justin Pryzby wrote:
When you dropped the index, you necessarily refused the plan involving
index scan.
So it did merge join instead (which it thinks of as expensive because it has to
sort both sides).
As you saw, the rowcount estima
9.459 rows=20020 loops=1)
Sort Key: u.f, u.g
Sort Method: quicksort Memory: 1707kB
-> Seq Scan on u (cost=0.00..289.20 rows=20020 width=8)
(actual time=0.008..2.748 rows=20020 loops=1)
Planning Time: 0.239 ms
Execution Time: 34.585 ms
Using MCV lists in var_eq_non_c