Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A1BAA632FD8 for ; Thu, 1 Jul 2010 13:38:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 05139-02 for ; Thu, 1 Jul 2010 16:38:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.4.227.11]) by mail.postgresql.org (Postfix) with ESMTP id B6239632EA0 for ; Thu, 1 Jul 2010 13:38:02 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 258B684F8B; Fri, 2 Jul 2010 00:37:59 +0800 (WST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 60C2AAEC02; Fri, 2 Jul 2010 00:36:55 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id snBhPdGIZLlF; Fri, 2 Jul 2010 00:36:47 +0800 (WST) Received: from [10.1.1.3] (203-206-47-136.dyn.iinet.net.au [203.206.47.136]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 57B22AEBFF; Fri, 2 Jul 2010 00:36:47 +0800 (WST) Message-ID: <4C2CC45F.4060505@postnewspapers.com.au> Date: Fri, 02 Jul 2010 00:37:51 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: Rajesh Kumar Mallah CC: pgsql-performance@postgresql.org Subject: Re: how to (temporarily) disable/minimize benefits of disk block cache or postgresql shared buffer References: In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-10 required=5 tests=BAYES_20=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/10 X-Sequence-Number: 39399 On 01/07/10 17:41, Rajesh Kumar Mallah wrote: > Hi, > > this is not really a performance question , sorry if its bit irrelevant > to be posted here. We have a development environment and we want > to optimize the non-database parts of the application. The problem is > that subsequent run of queries are execute very fast and makes the > performance analysis a trivial problem. We want that the subsequent runs > of query should take similar times as the first run so that we can work > on the optimizing the calling patterns to the database. You can get rid of PostgreSQL's caches in shared_buffers by restarting the PostgreSQL server. I don't know if there's any more convenient way. Alternately, just set a really minimal shared_buffers that's just enough for your connections so there's not much room for cached data. If you are running a Linux server (as you didn't mention what you're running on) you can drop the OS disk cache quite easily: http://linux-mm.org/Drop_Caches http://www.linuxinsight.com/proc_sys_vm_drop_caches.html AFAIK for most other platforms you have to use a tool that gobbles memory to force caches out. On Windows, most of those garbage tools that claim to "free" memory do this - it's about the only time you'd ever want to use one, since they do such horrid things to performance. -- Craig Ringer