Slow query performance on large table - Mailing list pgsql-performance

From Paul McKay
Subject Slow query performance on large table
Date
Msg-id 000001c2e25c$ad506170$0c64a8c0@paulspc
Whole thread Raw
Responses Re: Slow query performance on large table  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Slow query performance on large table  (Andrew Sullivan <andrew@libertyrms.info>)
List 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@clearwater-it.co.uk

t:0161 877 6090

m: 07713 510946

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

 

pgsql-performance by date:

Previous
From: Alex Johnson
Date:
Subject: Re: Slow performance with join on many fields
Next
From: Tomasz Myrta
Date:
Subject: Re: Slow query performance on large table