Re: database performance and query performance question - Mailing list pgsql-performance

From Josh Berkus
Subject Re: database performance and query performance question
Date
Msg-id 200401221200.45188.josh@agliodbs.com
Whole thread Raw
In response to database performance and query performance question  ("Shea,Dan [CIS]" <Dan.Shea@ec.gc.ca>)
Responses Re: database performance and query performance question
List pgsql-performance
Dan,

> Should there be less columns in the index?
> How can we improve database performance?
> How should I improve my query?

Your query plan isn't the problem.  It's a good plan, and a reasonably
efficient query.   Under other circumstances, the SELECT DISTINCT with the
to_char could be a performance-killer, but it's not in that result set.

Overall, you're taking 9 seconds to scan 93 million records.  Is this the time
the first time you run the query, or the 2nd and successive times?

When did you last run VACUUM ANALYZE on the table?   Have you tried increasing
the ANALYZE statistics on the index columns to, say, 500?

Your disks are RAID 5.  How many drives?  In RAID5, more drives improves the
speed of large scans.

And what's your sort_mem setting?   You didn't mention it.

Why is your effective cache size only 300mb when you have 3 GB of RAM?  It's
not affecting this query, but it could affect others.

--
-Josh Berkus
 Aglio Database Solutions
 San Francisco


pgsql-performance by date:

Previous
From: "Shea,Dan [CIS]"
Date:
Subject: database performance and query performance question
Next
From: Josh Berkus
Date:
Subject: Re: database performance and query performance question