Re: Help in avoiding a query 'Warm-Up' period/shared buffer - Mailing list pgsql-performance

From Jim C. Nasby
Subject Re: Help in avoiding a query 'Warm-Up' period/shared buffer
Date
Msg-id 20060106031421.GM43311@pervasive.com
Whole thread Raw
In response to Re: Help in avoiding a query 'Warm-Up' period/shared buffer  (David Lang <dlang@invendra.net>)
List pgsql-performance
On Thu, Jan 05, 2006 at 06:50:22PM -0800, David Lang wrote:
> On Thu, 5 Jan 2006, Mark Liberman wrote:
>
> >Obviously, I will be testing this - but it might take a few days, as I
> >haven't
> >figure out how to simulate the "period of inactivity" to get the data
> >flushed
> >out of the cache ... so I have to run this each morning.
>
> cat large_file >/dev/null
>
> will probably do a pretty good job of this (especially if large_file is
> noticably larger then the amount of ram you have)

The following C code is much faster...

/*
 * $Id: clearmem.c,v 1.1 2003/06/29 20:41:33 decibel Exp $
 *
 * Utility to clear out a chunk of memory and zero it. Useful for flushing disk buffers
 */

int main(int argc, char *argv[]) {
    if (!calloc(atoi(argv[1]), 1024*1024)) { printf("Error allocating memory.\n"); }
}

Compile it and then pass in the number of MB of memory to allocate on
the command line.
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

pgsql-performance by date:

Previous
From: "Qingqing Zhou"
Date:
Subject: Re: Help in avoiding a query 'Warm-Up' period/shared buffer cache
Next
From: Tom Lane
Date:
Subject: Re: Slow query. Any way to speed up?