Обсуждение: Testing query times
Hi, The first time I use a query its much slower than the second, third etc. I want to do some testing with the 1st (slower) time. The only way I have found to reproduce that slow time is to restart my computer which is a huge pain. Is there a better way to clear whatever Postgres is holding to make them faster. I have tried restarting the Postgres service but that doesn't help. Christine Penner Ingenious Software 250-352-9495 christine@ingenioussoftware.com
On Thu, Dec 3, 2009 at 2:55 PM, Christine Penner <christine@ingenioussoftware.com> wrote: > Hi, > > The first time I use a query its much slower than the second, third etc. I > want to do some testing with the 1st (slower) time. The only way I have > found to reproduce that slow time is to restart my computer which is a huge > pain. Is there a better way to clear whatever Postgres is holding to make > them faster. I have tried restarting the Postgres service but that doesn't > help. Restarting pgsql accomplishes the same thing as regards pgsql. BUT most OSes also cache, so you need a way to flush the kernel / file system cache. That depends on which OS you're running.
Scott Marlowe wrote:
And on Windows you should be able to clear it with CacheSet: http://technet.microsoft.com/en-us/sysinternals/bb897561.aspx
Can't tell if this is Linux or Windows from how the question was asked. Here's how to clear the OS cache on Linux:Restarting pgsql accomplishes the same thing as regards pgsql. BUT most OSes also cache, so you need a way to flush the kernel / file system cache. That depends on which OS you're running.
sync; echo 3 > /proc/sys/vm/drop_caches
And on Windows you should be able to clear it with CacheSet: http://technet.microsoft.com/en-us/sysinternals/bb897561.aspx
-- Greg Smith 2ndQuadrant Baltimore, MD PostgreSQL Training, Services and Support greg@2ndQuadrant.com www.2ndQuadrant.com