Re: [BUGS] BUG #8130: Hashjoin still gives issues

From: Igor Neyman <ineyman(at)perceptron(dot)com>
To: Stefan de Konink <stefan(at)konink(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #8130: Hashjoin still gives issues
Date: 2013-05-01 17:59:22
Message-ID: A76B25F2823E954C9E45E32FA49D70EC1B7C930B@mail.corp.perceptron.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-performance

> -----Original Message-----
>

>
> The original query:
>
> select * from ambit_privateevent_calendars as a, ambit_privateevent as
> b, ambit_calendarsubscription as c, ambit_calendar as d where
> c.calendar_id = d.id and a.privateevent_id = b.id and c.user_id = 1270
> and c.calendar_id = a.calendar_id and c.STATUS IN (1, 8, 2, 15, 18, 4,
> 12, 20) and not b.main_recurrence = true;
>
> select b.id from ambit_privateevent_calendars as a, ambit_privateevent
> as b, ambit_calendarsubscription as c, ambit_calendar as d where
> c.calendar_id = d.id and a.privateevent_id = b.id and c.user_id = 1270
> and c.calendar_id = a.calendar_id and c.STATUS IN (1, 8, 2, 15, 18, 4,
> 12, 20) and not b.main_recurrence = true;
>
> (select * => select b.id, the star query is *fastest*)
>
> We compare:
> http://explain.depesz.com/s/jRx
> http://explain.depesz.com/s/eKE
>
>
> By setting "set enable_hashjoin = off;" performance in our entire
> application increased 30 fold in throughput, which was a bit unexpected
> but highly appreciated. The result of the last query switch the
> mergejoin:
>
> http://explain.depesz.com/s/AWB
>
> It is also visible that after hashjoin is off, the b.id query is faster
> than the * query (what would be expected).
>
>
> Our test machine is overbudgetted, 4x the memory of the entire database
> ~4GB, and uses the PostgreSQL stock settings.
>
>
> Stefan
>

I'd suggest that you adjust Postgres configuration, specifically memory settings (buffer_cache, work_mem, effective_cache_size), to reflect your hardware config, and see how it affects your query.

Regards,
Igor Neyman

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Davis 2013-05-01 20:07:34 Re: [BUGS] BUG #8130: Hashjoin still gives issues
Previous Message Tom Lane 2013-05-01 17:38:34 Re: Re: [BUGS] BUG #8128: pg_dump (>= 9.1) failed while dumping a scheme named "old" from PostgreSQL 8.4

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Davis 2013-05-01 20:07:34 Re: [BUGS] BUG #8130: Hashjoin still gives issues
Previous Message Igor Neyman 2013-05-01 17:26:01 Re: Deterioration in performance when query executed in multi threads