Re: [PERFORM] Performance of complicated query

2013-05-28 Thread Steve Crawford
On 05/23/2013 05:21 PM, Jonathan Morra wrote: Sorry for the messy query, I'm very new to writing these complex queries. I'll try and make it easier to read by using WITH clauses. However, just to clarify, the WITH clauses only increase readability and not performance in any way, right? It d

Re: [PERFORM] Performance of complicated query

2013-05-28 Thread Jonathan Morra
I have been working on this query, and I was able to modify it and get it's run time cut in half. Here's where it is right now: SELECT first_name, last_name, serial_number, latest_read, value, lifetime_value, lifetime.patient_id FROM ( SELECT DISTINCT patient_id, first_name, last_name, MAX(read_d

Re: [PERFORM] Slow SELECT by primary key? Postgres 9.1.2

2013-05-28 Thread Matheus de Oliveira
On Mon, May 27, 2013 at 11:02 AM, John Mudd wrote: > Postgres 9.1.2 on Ubuntu 12.04 > > Any reason why a select by primary key would be slower than a select that > includes an ORDER BY? I was really hoping using the primary key would give > me a boost. > > I stopped the server and cleared the O/S

Re: [PERFORM] Slow SELECT by primary key? Postgres 9.1.2

2013-05-28 Thread Roman Konoval
John, And can you please include BUFFERS to ANALYZE? Regards, Roman Konoval On Tue, May 28, 2013 at 9:48 AM, Evgeniy Shishkin wrote: > > > > > On 28.05.2013, at 2:17, John Mudd wrote: > > Thanks again. > > Well, I have two problems with using the CLUSTER option. It's only > temporary since an