Re: Hardware suggestions for maximum read performance

From: Greg Smith <greg(at)2ndQuadrant(dot)com>
To: Mike McCann <mccann(at)mbari(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org, Yuri Levinsky <yuril(at)celltick(dot)com>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Julien Cigar <jcigar(at)ulb(dot)ac(dot)be>, Arjen van der Meijden <acmmailing(at)tweakers(dot)net>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Subject: Re: Hardware suggestions for maximum read performance
Date: 2013-05-20 02:44:16
Message-ID: 51998E00.9010704@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Smith 2013-05-20 02:55:28 Re: Deleting Rows From Large Tables
Previous Message Cuong Hoang 2013-05-20 02:41:32 Re: Reliability with RAID 10 SSD and Streaming Replication