Skip to content
Advertisement

Postgresql Bitmap Heap Scan slow

My table looks like:

I need to search the table with ILIKE on search_string.
There may be many different search queries in the same request.

My query looks like:

Explain for searching without index

I tried to make it faster by creating GIN index:

Explain for searching with index

Why are my index searches slower than seq scan?
Is there any way to make this type of search faster?

Advertisement

Answer

Your problem are probably the 66186 lossy blocks. Increase work_mem until you have only exact blocks.

Considering that you have a million result rows, I’d say that this query will never be very fast unless you reduce the number to result rows.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement