Mathieu De Zutter wrote:
You didn't include any information on your hardware and OS, which can
be very important. Also, what version of PostgreSQL is this?
SELECT version(); output would be good.
> How can I make pgsql realize that it should always pick the index
> scan?
That would probably be a very bad thing to do, in a general sense.
I'm not even convinced yet it's really what you want in this case.
> shared_buffers = 24MB
> work_mem = 8MB
> #effective_cache_size = 128MB
Those are probably not optimal; however, without information on your
hardware and runtime environment, I can't make any concrete
suggestion.
> #seq_page_cost = 1.0
> #random_page_cost = 4.0
It's entirely possible that you will get plans more appropriate to
your hardware and runtime environment by adjusting these. Again, I
lack data to propose anything specific yet.
-Kevin