Re: query plan question, nested loop vs hash join

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: Andrey Lizenko <lizenko79(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: query plan question, nested loop vs hash join
Date: 2014-10-07 20:26:38
Message-ID: CABRT9RCqFzidSEADW5TeNhZxNaVCtabJhOtJfr-aOHqWGTJcsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Oct 3, 2014 at 6:38 PM, Andrey Lizenko <lizenko79(at)gmail(dot)com> wrote:
> Is it possible to force optimizer choose the second plan without doing "set
> enable_hashjoin = off;" ?
>
> Increasing of 'effective_cache_size' leads to similar thing with mergejoin,
> other options (work_mem, shared_buffers. etc) do not change anything.

Have you tried changing random_page_cost?

In small databases where most of the data is cached anyway, lowering
random_page_cost to somewhere between 1 and 2 usually leads to better
planner decisions.

Regards,
Marti

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Sergey Konoplev 2014-10-07 20:41:04 Re: help: function failing
Previous Message Mike Blackwell 2014-10-07 19:55:48 Re: pg_basebackup - odd performance