Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 0E5CD633261 for ; Fri, 12 Jun 2009 19:25:46 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 58104-01 for ; Fri, 12 Jun 2009 19:25:38 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f206.google.com (mail-fx0-f206.google.com [209.85.220.206]) by mail.postgresql.org (Postfix) with ESMTP id 47183633090 for ; Fri, 12 Jun 2009 19:25:44 -0300 (ADT) Received: by fxm2 with SMTP id 2so519860fxm.19 for ; Fri, 12 Jun 2009 15:25:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=PDPZG58CX2V9k6+623DTep6oxbc9yXOeE79Ulyl5ehs=; b=FDBbyuKv2oHlcoCalquSqWtLBpowCoz0LkZQrEIZU8Br6ZT7U2SxH9uM+DxAAG9C5w UEPOzok2m9lHGmdrqwLCHXa5kkzSRc4URFdz6VaR4yHm1DDmQbIktycy4+w6f6a4yxWV MDwQayFRYv2T5KCWoz57UuTfzEPHVn6eNUFqc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=vXE9fci5fcINqV756g0ZCjYrypA+jjRN2k7Dsu37U34vgLMVxBBgwWGXVJvSHiAIbL 0mlj2/VFJZP8WJrkLgjvfNl5dE83y61o/bAxB2m5x94EHoS0qFBcGw+1kuaKUPfDV91X Dl0dI6WlH//Qd4fnEWBiWOBDTJ7AEDCruIOPU= MIME-Version: 1.0 Received: by 10.103.251.3 with SMTP id d3mr1051688mus.8.1244845539125; Fri, 12 Jun 2009 15:25:39 -0700 (PDT) In-Reply-To: <875976BE-CAC0-4F10-B7CC-0D651B109967@engineyard.com> References: <4A2EA121.2070004@gmail.com> <875976BE-CAC0-4F10-B7CC-0D651B109967@engineyard.com> From: Greg Stark Date: Sat, 13 Jun 2009 00:25:19 +0200 X-Google-Sender-Auth: c3417496161bfbbb Message-ID: <407d949e0906121525w1e0f13f0vf41bd9f63c032ebe@mail.gmail.com> Subject: Re: Taking the cache out of the equation? To: Erik Jones Cc: Rob Sargent , pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/66 X-Sequence-Number: 32671 On Sat, Jun 13, 2009 at 12:12 AM, Erik Jones wrote: > > On Jun 9, 2009, at 10:51 AM, Rob Sargent wrote: > >> Caching helps a *lot* and I'm thankful for that but I would like to take >> it out of the picture as I massage my queries for better performance. >> =A0Naturally the first invocation of the query cannot take advantage of = the >> cache and these queries would normally only be called once for the same >> target data. =A0 =A0What tricks are there to flush, ignore, circumvent t= he >> caching boost? =A0(Especially in the production environment.) > > Why on earth would you want your queries to always go to disk? I think he answered that in the original message -- to better represent the real workload. Unfortunately there isn't really a good answer. On Linux you can echo 1 > /proc/sys/vm/drop_caches but that doesn't affect the postgres shared buffers and worse, it does affect other buffers that probably would still be cached. The best answer is usually to build a test configuration large enough that it has similar cache effects as your production environment. Then test random values and repeat the test many times to avoid any random fluctuations. --=20 greg http://mit.edu/~gsstark/resume.pdf