In postgresql
select * from test where text123 = '1'
"Index Scan using ix_test on test (cost=0.57..12619.44 rows=6980 width=343)"
" Index Cond: ((text123)::text = '1'::text)"
select * from test where text123 = ''
"Seq Scan on test (cost=0.00..11918891.20 rows=209355618 width=343)"
" Filter: ((text123)::text = ''::text)"
first query result returns immediately. but second isn't.
In Oracle, it has same plan with postgresql but second query result returns immediately.
What can I do for second query in postgresql? And why second query is so slow?
please help me...
analyze test;in postgresql. It should just recompute the stats on the test table so the query plan can be the best available. Change the select list when you test the query again, egselect text123 from test where text123 = '1'so you can be sure it's re-preparing the query plan. Report back with the result - this may or may not fix it immediately.