Re: [PERFORM] Slow Query

2015-08-12 Thread robbyc
Hi Vik, Thanks for your feedback, very helpful. I modified your query slightly, this will return all vacancy templates and all level 1 vacancies which arent templates, and does so in about ~800-900ms less, an great improvement on the original query. SELECT "Vacancy"."ID", "Vacancy"."JobTi

Re: [PERFORM] Slow Query

2015-08-12 Thread Vik Fearing
On 08/12/2015 04:34 AM, robbyc wrote: > Hi, > > I am new to optimizing queries and i'm getting a slow running time > (~1.5secs) with the following SQL: Before mucking about with work_mem and indexes, the first thing to do is rewrite this query correctly. Here are just some of the things wrong wi

Re: [PERFORM] Query Plan Performance on Partitioned Table

2015-08-12 Thread Rural Hunter
I tried to add index on partition key and it didn't help. we have autovacuum running. The updates and inserts are very frequent on these tables. The server kernel version is 3.5.0-22-generic. It has 376G memory. max_connections = 2500# (change requires restart) shared_buffers = 32GB

Re: [PERFORM] Query Plan Performance on Partitioned Table

2015-08-12 Thread Pietro Pugni
You can give it a try only on that partition just to see if your query plan gets better. I prefer defining partitioning over ranging attributes like, for example: cid between 123 and 456. It makes more sense, especially when there are attributes which value strictly depends on the check attribute.