From: Josh Berkus <josh@agliodbs.com>
To: Shea,Dan [CIS] <Dan.Shea@ec.gc.ca>
To: pgsql-performance@postgresql.org
Subject: Re: database performance and query performance question
Date: Thu, 22 Jan 2004 12:00:45 -0800
Message-ID: <200401221200.45188.josh@agliodbs.com> (raw)
In-Reply-To: <F2D63B916C88C14D9B59F93C2A5DD33F0B9117@cisxa.cis.ec.gc.ca>
References: <F2D63B916C88C14D9B59F93C2A5DD33F0B9117@cisxa.cis.ec.gc.ca>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: josh@agliodbs.com, Dan.Shea@ec.gc.ca
Subject: Re: database performance and query performance question
In-Reply-To: <200401221200.45188.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox