Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1THLDA-0002wP-76 for pgsql-performance@postgresql.org; Thu, 27 Sep 2012 21:01:32 +0000 Received: from smtp.peak6.com ([38.98.137.6]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1THLD7-0004b1-96 for pgsql-performance@postgresql.org; Thu, 27 Sep 2012 21:01:31 +0000 X-AuditID: 0a64cb1e-b7fb36d000000f29-c8-5064bea18ccd Message-ID: <5064BEA6.3000506@optionshouse.com> Date: Thu, 27 Sep 2012 16:01:26 -0500 From: Shaun Thomas Reply-To: Organization: Peak6 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: Scott Marlowe CC: "M. D." , Craig James , Subject: Re: hardware advice References: <5064A4DC.5090304@turnkey.bz> <5064BB1E.4090904@turnkey.bz> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed content-transfer-encoding: 7bit X-Originating-IP: [10.10.201.64] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMIsWRmVeSWpSXmKPExsXClcIrprtwX0qAweRjxhb7V2xltNi5aAez xfWZ55gtln06z+jA4nFl53FGj52z7rJ7XNg3jd3j7bLF7AEsUQ2MNol5efkliSWpCimpxcm2 Sv4FJZn5ecUe+aXFqQoumcXJOYmZualFSgqZKbZK5koKBTmJyam5qXkltkqJBQWpeSlKdlwK GMAGqCwzTyE1Lzk/JTMv3VbJM9hf18LC1FLXUMkuHhkkdLJkbFkaVtDIVtF2/j17A+Ntli5G Tg4JAROJn5/vMUHYYhIX7q1nA7F5BfQlPi68ywpiswioSjxv+g9mswnoSkzqXwFWIySgItF3 9gZYL7+AsMS+D03MILaoQJDEso3fmSDmCEqcnPkEbJeIgLbEozfXGUFsZoFMieUPf4DNERZQ k9h8GsTmApp5kVHi94vVYM2cAoESq5/fhWqwlbgw5zoLhC0vsf3tHGaII1QlVjRPZIN4QEHi /5V3TBMYhWYh2T0LSfssJO0LGJlXMYoXlyUmZ2SaFhTnlhQY6hWkJmab6eWllmxiBEf4abkd jNOXKh5iFOBgVOLhNVyUEiDEmlhWXJl7iFGCg1lJhNd5MVCINyWxsiq1KD++qDQntfgQoykw 0CYyS4km5wOTT15JvKGxoaWppYmZpbmxsYGSOK9tn1KAkEA6MDlkp6YWpBbB9DFxcEo1MM55 5b/m0v8XaZZ/485uvMLxITLTaU9TpbWgUfGhoo/LFITPMu27V6l0dnE9R6ajTO+CLb8KWhTS l69YlPKyg3WK1Un7tN8r2XLOT2YJMfD56dKj5/p/Wzj/u81zbN7rFVne0uhn6DmgOW9ZNIt5 0NGOC+Fv1L9vYSmK6Wh8uXVnadp0hVhuESWW4oxEQy3mouJEAPGPiUoGAwAA X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201209/170 X-Sequence-Number: 47916 On 09/27/2012 03:55 PM, Scott Marlowe wrote: > Have you tried re-writing this query first? Is there a reason to have > a bunch of subselects instead of joining the tables? What pg version > are you running btw? A newer version of pg might help too. Wow, yeah. I was just about to say something about that. I even pasted it into a notepad and started cutting it apart, but I wasn't sure about enough of the column sources in all those subqueries. It looks like it'd be a very, very good candidate for a window function or two, and maybe a few CASE statements. But I'm about 80% certain it's not very efficient as is. -- Shaun Thomas OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604 312-444-8534 sthomas@optionshouse.com ______________________________________________ See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email