Re: Forcing using index instead of sequential scan?

From: Gregory Stark <gsstark(at)mit(dot)edu>
To: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, robin(dot)c(dot)smith(at)bt(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: Forcing using index instead of sequential scan?
Date: 2006-07-22 23:15:31
Message-ID: 87slktteng.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Craig A. James" <cjames(at)modgraph-usa(dot)com> writes:

> This causes massive file-system activity and flushes all files that the
> kernel has cached. If you run this between each Postgres test (let it run
> for a couple minutes), it gives you an apples-to-apples comparison between
> successive benchmarks, and eliminates the effects of caching.

On Linux at least the best way to flush the cache is to unmount and then mount
the filesystem. This requires putting the data files on partition that you
aren't otherwise using and shutting down postgres.

Note that "nothing cached" isn't necessarily any more accurate a model as
"everything cached". In reality many databases *do* in fact run the same
queries over and over again, though often with some parameters different each
time. But the upper pages of most indexes and many of the common leaf pages
and heap pages will in fact be cached.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Kirkwood 2006-07-23 03:28:48 Re: Forcing using index instead of sequential scan?
Previous Message Craig A. James 2006-07-22 17:26:53 Re: Forcing using index instead of sequential scan?