Re: Help in avoiding a query 'Warm-Up' period/shared buffer

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: David Lang <dlang(at)invendra(dot)net>
Cc: Mark Liberman <mliberman(at)mixedsignals(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Help in avoiding a query 'Warm-Up' period/shared buffer
Date: 2006-01-06 03:14:21
Message-ID: 20060106031421.GM43311@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2006-01-06 05:07:57 Re: Slow query. Any way to speed up?
Previous Message Qingqing Zhou 2006-01-06 03:08:05 Re: Help in avoiding a query 'Warm-Up' period/shared buffer cache