Re: Seeking help with a query that takes too long - Mailing list pgsql-performance

From Manfred Koizar
Subject Re: Seeking help with a query that takes too long
Date
Msg-id ha0arv4a4d5b79pmjiil0djlu0qkqj4mqp@email.aon.at
Whole thread Raw
In response to Re: Seeking help with a query that takes too long  ("Nick Fankhauser" <nickf@ontko.com>)
List pgsql-performance
On Fri, 14 Nov 2003 11:00:38 -0500, "Nick Fankhauser"
<nickf@ontko.com> wrote:
>Good question... I've never used clustering in PostgreSQL before, so I'm
>unsure. I presume this is like clustering in Oracle where the table is
>ordered to match the index?

Yes, something like that.  With the exception that Postgres looses the
clustered status, while you INSERT and UPDATE tuples.  So you have to
re-CLUSTER from time to time.  Look at pg_stats.correlation to see, if
its necessary.

> Is there a way to flush out
>the cache in a testing situation like this in order to start from a
>consistent base?

To flush Postgres shared buffers:
    SELECT count(*) FROM another_large_table;

To flush your database pages from the OS cache:
    tar cf /dev/null /some/large/directory

And run each of your tests at least twice to get a feeling how caching
affects your specific queries.

Servus
 Manfred

pgsql-performance by date:

Previous
From: Neil Conway
Date:
Subject: Re: Query question
Next
From: Tom Lane
Date:
Subject: Re: Query question