Re: Recursive query performance issue - Mailing list pgsql-performance

From Pavel Stehule
Subject Re: Recursive query performance issue
Date
Msg-id CAFj8pRA9yQFJ3ZmBDCz-XZa3cxZPuF3H9ms3XTDtkqjVFyXpyg@mail.gmail.com
Whole thread Raw
In response to Recursive query performance issue  (Jamie Koceniak <jkoceniak@mediamath.com>)
Responses Re: Recursive query performance issue
List pgsql-performance


2015-10-21 19:55 GMT+02:00 Jamie Koceniak <jkoceniak@mediamath.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.stehule@gmail.com]
Sent: Wednesday, October 21, 2015 12:04 AM
To: Jamie Koceniak
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Recursive query performance issue

 

Hi

 

2015-10-20 19:34 GMT+02:00 Jamie Koceniak <jkoceniak@mediamath.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

 

 

 


pgsql-performance by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Recursive query performance issue
Next
From: Pavel Stehule
Date:
Subject: Re: Recursive query performance issue