Re: database performance and query performance question

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Shea,Dan [CIS]" <Dan(dot)Shea(at)ec(dot)gc(dot)ca>, pgsql-performance(at)postgresql(dot)org
Subject: Re: database performance and query performance question
Date: 2004-01-22 20:00:45
Message-ID: 200401221200.45188.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2004-01-22 20:21:19 Re: database performance and query performance question
Previous Message Shea,Dan [CIS] 2004-01-22 19:47:04 database performance and query performance question