Re: Indices arent being used - Mailing list pgsql-performance

From Tom Lane
Subject Re: Indices arent being used
Date
Msg-id 6354.1064682842@sss.pgh.pa.us
Whole thread Raw
In response to Re: Indices arent being used  (rantunes@student.dei.uc.pt)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: rantunes@student.dei.uc.pt
Date:
Subject: Re: Indices arent being used
Next
From: Richard Jones
Date:
Subject: advice on raid controller