Slow query performance on large table

From: "Paul McKay" <paul_mckay(at)clearwater-it(dot)co(dot)uk>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Slow query performance on large table
Date: 2003-03-04 14:45:18
Message-ID: 000001c2e25c$ad506170$0c64a8c0@paulspc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I am executing a query on a table:

Table "public.measurement"

Column | Type | Modifiers

------------+-----------------------+-----------

assessment | integer |

time | integer |

value | character varying(50) |

Indexes: idx_measurement_assessment btree (assessment),

idx_measurement_time btree ("time")

The primary key of the table is a combination of assessment and time,
and there are indexes on both assessment and time.

The query I am executing is

Select time,value

>From measurement

Where assessment = ?

And time between ? and ?

This used to run like a rocket before my database got a little larger.
There are now around 15 million rows in the table and it is taking a
long time to execute queries that get a fair number of rows back (c.300)

The database is 'VACUUM ANALYZED' regularly, and I've upped the shared
buffers to a significant amount.

I've tried it on various machine configurations now. A dual processor
Linux/Intel Machine with 1G of Memory, (0.5G shared buffers). A single
processor Linux/Intel Machine (0.25G shared buffers) , and a Solaris
machine (0.25G shared buffers). I'm getting similar performance on all
of them.

Anybody see anything I've obviously done wrong? Any ways of improving
the performance of this query?

Thanks in advance.

Paul McKay.

======================================

Paul Mckay

Consultant Partner

Servicing Division

Clearwater-IT

e:paul_mckay(at)clearwater-it(dot)co(dot)uk

t:0161 877 6090

m: 07713 510946

======================================

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tomasz Myrta 2003-03-04 15:09:51 Re: Slow query performance on large table
Previous Message Alex Johnson 2003-03-04 07:46:38 Re: Slow performance with join on many fields