On Mon, 15 Sep 2003 22:26:45 -0400, Christopher Browne
<cbbrowne@acm.org> wrote:
>> select count (*) from table;
>The only possible plan for THAT query will involve a seq scan of the
>whole table. If the postmaster already has the data in cache, it
>makes sense for it to run in 1 second. If it has to read it from
>disk, 12 seconds makes a lot of sense.
Yes. And note that the main difference is between having the data in
memory and having to fetch it from disk. I don't believe that this
difference can be explained by 9000 read calls hitting the operating
system's cache.
>You might want to increase the "shared_buffers" parameter in
>postgresql.conf; that should lead to increased stability of times as
>it should be more likely that the data in "table" will remain in
>cache.
Let's not jump to this conclusion before we know what's going on.
Joseph Bove <jbove@vetstar.com> wrote in another message above:
| I did have shared_buffers and sort_mem both set higher originally (15000,
| 32168)
As I read this I think he meant "... and had the same performance
problem."
Joseph, what do you get, if you run that
EXPLAIN ANALYSE SELECT count(*) ...
several times? What do vmstat and top show while the query is
running? Are there other processes active during or between the runs?
What kind of processes? Postgres backends? Web server? ...
Servus
Manfred