Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UeG5L-000861-HN for pgsql-performance@arkaria.postgresql.org; Mon, 20 May 2013 02:44:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UeG5L-0008FI-26 for pgsql-performance@arkaria.postgresql.org; Mon, 20 May 2013 02:44:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UeG5K-0008FD-AW for pgsql-performance@postgresql.org; Mon, 20 May 2013 02:44:26 +0000 Received: from moutng.kundenserver.de ([212.227.17.10]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UeG5F-00018x-VQ for pgsql-performance@postgresql.org; Mon, 20 May 2013 02:44:26 +0000 Received: from [192.168.1.110] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0M7R91-1UJZwL21G3-00xLFZ; Mon, 20 May 2013 04:44:20 +0200 Message-ID: <51998E00.9010704@2ndQuadrant.com> Date: Sun, 19 May 2013 22:44:16 -0400 From: Greg Smith User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Mike McCann CC: pgsql-performance@postgresql.org, Yuri Levinsky , Scott Marlowe , Julien Cigar , Arjen van der Meijden , Jeff Janes Subject: Re: Hardware suggestions for maximum read performance References: <3C9B31A5-F8FE-4161-A374-971D5DF69E8A@mbari.org> <44A45613-5E99-4E61-975E-48F957B971FC@mbari.org> In-Reply-To: <44A45613-5E99-4E61-975E-48F957B971FC@mbari.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:JPDAnCftsHH6xZAw8y44KYYeAZCL6sh+OU+Kw4UAAq5 idKQjsectikqDZzwWWatHpsc7nucPlJHB8Jppy2tC1fXwGxkE0 TEMUlh2l1spYkfZFIUB1dk407EPVx/NDjo0Rt0/248Fk9N93r2 iSj+hVe8bgOyUfAvq7tWZVxfBJqZU1rMoEcymM3xYiOGEqUxst D1qSIOYtBRomUguJHdbt9pts8oHudJMeAMy+5F2+XdowX4gs96 DiuAUoKUJNYQY0LGmhv6KmVCByjDYbOCOkgTVH+pOlG2qqG1XX RegZ0xHHzFw37KOY5NmIR020UreLesuFjs7afvryraqoyAGryp kO0QCtPgyXPFjxNMJIyM= X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 5/13/13 6:36 PM, Mike McCann wrote: > stoqs_march2013_s=# explain analyze select * from > stoqs_measuredparameter order by datavalue; > > QUERY PLAN > ------------------------------------------------------------------------------------------------------------------------------------------ > Sort (cost=422106.15..430560.68 rows=3381814 width=20) (actual > time=2503.078..2937.130 rows=3381814 loops=1) > Sort Key: datavalue > Sort Method: quicksort Memory: 362509kB > -> Seq Scan on stoqs_measuredparameter (cost=0.00..55359.14 > rows=3381814 width=20) (actual time=0.016..335.745 rows=3381814 loops=1) > Total runtime: 3094.601 ms > (5 rows) > > I tried changing random_page_cost to from 4 to 1 and saw no change. Have you tried putting an index by datavalue on this table? Once you've done that, then changing random_page_cost will make using that index look less expensive. Sorting chews through a good bit of CPU time, and that's where all of your runtime is being spent at--once you increase work_mem up very high that is. > I'm wondering now what changes might get this query to run in less than > one second. If all the data is in memory, then will faster CPU and > memory be the things that help? You're trying to fix a fundamental design issue with hardware. That usually doesn't go well. Once you get a box big enough to hold the whole database in RAM, beyond that the differences between server systems are relatively small. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance