rantunes@student.dei.uc.pt writes:
> Here is the explain analyze of the query:
> explain analyze select count(*) from actvars, prodlevel where
> actvars.product_level=prodlevel.code_level and
> prodlevel.division_level='OY3S5LAPALL6';
> [ slow merge join ]
I wonder whether a hash join wouldn't work better. Can you force a hash
join? (Try "enable_mergejoin = 0" and if needed "enable_nestloop = 0";
don't disable seqscans though.) If you can get such a plan, please post
the explain analyze results for it.
> This method forces the indices to work but it looks like it takes a long to
> finish executing, I had to cancel the query after 10 min.
"Force use of the indexes" is not always an answer to performance issues.
regards, tom lane