Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIHGe-0004cP-Un for pgsql-general@arkaria.postgresql.org; Fri, 24 Nov 2017 16:55:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIHGe-0006x6-Ao for pgsql-general@arkaria.postgresql.org; Fri, 24 Nov 2017 16:55:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eIHGe-0006ww-0W for pgsql-general@lists.postgresql.org; Fri, 24 Nov 2017 16:55:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eIHGb-0004hk-OM for pgsql-general@postgresql.org; Fri, 24 Nov 2017 16:55:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAOGtq52029150; Fri, 24 Nov 2017 11:55:52 -0500 From: Tom Lane To: bricklen cc: hmidi slim , "pgsql-general@postgresql.org" Subject: Re: How clear the cache on postgresql? In-reply-to: References: Comments: In-reply-to bricklen message dated "Fri, 24 Nov 2017 07:00:43 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <29148.1511542552.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 24 Nov 2017 11:55:52 -0500 Message-ID: <29149.1511542552@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk bricklen writes: > On Fri, Nov 24, 2017 at 6:54 AM, hmidi slim wrote: >> I'm trying to analyze some queries using the explain instructions and the >> option analyze and buffers. I realized that the query refers to the cache >> memory to return the results. Is there any solution to clear the cache in >> postgresql inorder to get execution time of the query when it get data from >> disk and not from cache memory? > If you are on a (non-production) *nix server you can use: > sync && echo 3 > /proc/sys/vm/drop_caches​ You would also need to restart the postmaster, to get rid of whatever is in Postgres' shared buffers. regards, tom lane