Re: Recursive query performance issue

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jamie Koceniak <jkoceniak(at)mediamath(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Recursive query performance issue
Date: 2015-10-21 19:45:20
Message-ID: CAFj8pRB9bzz5k9yHRo+Pj8ANbUdDyTZ2W2gS=8RRnBBH5LjMfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

2015-10-21 21:32 GMT+02:00 Jamie Koceniak <jkoceniak(at)mediamath(dot)com>:

> adama_prod=# SHOW shared_buffers;
>
> shared_buffers
>
> ----------------
>
> 64GB
>

can you try to increase shared buffers to 200GB and decrease effective
cache size to 180GB? If it is possibly - I am not sure, if this setting is
good fro production usage, but the result can be interesting for bottleneck
identification.

>
>
> *From:* Pavel Stehule [mailto:pavel(dot)stehule(at)gmail(dot)com]
> *Sent:* Wednesday, October 21, 2015 12:26 PM
>
> *To:* Jamie Koceniak
> *Cc:* pgsql-performance(at)postgresql(dot)org
> *Subject:* Re: [PERFORM] Recursive query performance issue
>
>
>
>
>
>
>
> 2015-10-21 20:51 GMT+02:00 Jamie Koceniak <jkoceniak(at)mediamath(dot)com>:
>
> Hi Pavel,
>
>
>
> Or were you referring to SHMMAX?
>
>
>
> value of shared_buffers - run SQL statements SHOW shared_buffers;
>
> Regards
>
> Pavel
>
>
>
> Thanks
>
>
>
> *From:* Jamie Koceniak
> *Sent:* Wednesday, October 21, 2015 11:40 AM
> *To:* 'Pavel Stehule'
> *Cc:* pgsql-performance(at)postgresql(dot)org
> *Subject:* RE: [PERFORM] Recursive query performance issue
>
>
>
> Ok
>
>
>
> df -h /dev/shm
>
> Filesystem Size Used Avail Use% Mounted on
>
> tmpfs 406G 0 406G 0% /run/shm
>
>
>
> Ok I will try lowering it.
>
>
>
> *From:* Pavel Stehule [mailto:pavel(dot)stehule(at)gmail(dot)com
> <pavel(dot)stehule(at)gmail(dot)com>]
> *Sent:* Wednesday, October 21, 2015 11:24 AM
>
>
> *To:* Jamie Koceniak
> *Cc:* pgsql-performance(at)postgresql(dot)org
> *Subject:* Re: [PERFORM] Recursive query performance issue
>
>
>
>
>
>
>
> 2015-10-21 19:55 GMT+02:00 Jamie Koceniak <jkoceniak(at)mediamath(dot)com>:
>
> Hi Pavel,
>
>
>
> Thanks for the reply.
>
>
>
> 1. The queries aren’t waiting on any locks.
>
> The query has a recursive join that uses a table with only 80k records and
> that table is not updated often.
>
>
>
> 2. The I/O load was not high. CPU utilization was very high and load was
> very high.
>
> We have a large effective_cache_size = 512GB (25% of total memory)
>
>
>
> so your server has 2TB RAM? It is not usual server - so this issue can be
> pretty strange :(
>
> What is size of shared memory? Probably is significantly lower than
> effective_cache_size? Try to reduce effective cache size to be lower than
> shared buffers
>
> Regards
>
> Pavel
>
>
>
>
>
>
> Thanks,
>
> Jamie
>
>
>
> *From:* Pavel Stehule [mailto:pavel(dot)stehule(at)gmail(dot)com]
> *Sent:* Wednesday, October 21, 2015 12:04 AM
> *To:* Jamie Koceniak
> *Cc:* pgsql-performance(at)postgresql(dot)org
> *Subject:* Re: [PERFORM] Recursive query performance issue
>
>
>
> Hi
>
>
>
> 2015-10-20 19:34 GMT+02:00 Jamie Koceniak <jkoceniak(at)mediamath(dot)com>:
>
> Version:
>
>
> -----------------------------------------------------------------------------------------------
>
> PostgreSQL 9.1.14 on x86_64-unknown-linux-gnu, compiled by gcc (Debian
> 4.7.2-5) 4.7.2, 64-bit
>
>
>
> Query Plan
>
> http://explain.depesz.com/s/4s37
>
>
>
> Normally, this query takes around 200-300 ms to execute.
>
> However when several queries are run concurrently, query performance drops
> to 30-60 seconds.
>
>
>
>
>
> there can be few reasons:
>
> 1. locking - are you sure, so your queries don't wait on locks?
>
> 2. issues with cache stability - is there high IO load? You can try to
> increase effective_cache_size (or decrease if you have not enough memory)
>
> Regards
>
> Pavel
>
>
>
>
>
>
>
>
>
>
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2015-10-21 19:49:33 Re: Recursive query performance issue
Previous Message Jamie Koceniak 2015-10-21 19:32:38 Re: Recursive query performance issue