There are two sql in a table, one of them is too slow, any one can tell me what's wrong and how can i optimize it?
There is their query explain blow:
[---------edit---------]
The bitmap index scan in the second query returns more rows because the condition is less selective.
As a consequence, the bitmap becomes too large to fit into work_mem
and PostgreSQL continues by storing one bit per matching block rather than per matching row (those are the lossy entries mentioned).
So many more rows have to be checked during the bitmap heap scan, which causes the longer execution time.
Increase work_mem
for better results.