Re: Index usage question - Mailing list pgsql-general

From Tom Lane
Subject Re: Index usage question
Date
Msg-id 27626.999628294@sss.pgh.pa.us
Whole thread Raw
In response to Index usage question  (Jefim Matskin <mjefim@sphera.com>)
List pgsql-general
Jefim Matskin <mjefim@sphera.com> writes:
> can anyone explain me what is wrong with my query?

Nothing.  Hash join is a perfectly respectable way to implement this
query.  If the size estimates quoted in the EXPLAIN are in the right
ballpark, I'd not be surprised to find that the planner made the right
choice --- nestloop will certainly be slower, and there's no reason to
think that a merge join based on index scans would be faster either.

You can try "set enable_hashjoin to off" if you want to experiment with
alternate plans, but you should check the actual timing before assuming
that you know better than the planner.

            regards, tom lane

pgsql-general by date:

Previous
From: "Mitch Vincent"
Date:
Subject: Re: Index usage question
Next
From: "Alex Knight"
Date:
Subject: Re: PL/java?