Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id BFA2E1337BDF for ; Wed, 13 Apr 2011 20:26:37 -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 80924-06 for ; Wed, 13 Apr 2011 23:26:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.gransy.com (mail.gransy.com [82.208.29.194]) by mail.postgresql.org (Postfix) with ESMTP id 0F3F21337BC4 for ; Wed, 13 Apr 2011 20:26:29 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.gransy.com (Postfix) with ESMTP id 0440A2E5A006 for ; Thu, 14 Apr 2011 01:26:29 +0200 (CEST) Received: from mail.gransy.com ([127.0.0.1]) by localhost (nathalia.gransy.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id itJP1Z3S3eZm for ; Thu, 14 Apr 2011 01:26:28 +0200 (CEST) Received: from [192.168.1.221] (ip-94-112-0-189.net.upcbroadband.cz [94.112.0.189]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id DB0A42E5A007 for ; Thu, 14 Apr 2011 01:26:28 +0200 (CEST) Message-ID: <4DA63125.5070106@fuzzy.cz> Date: Thu, 14 Apr 2011 01:26:29 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101219 Lightning/1.0b3pre Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Performance References: <20110412171855.GA14292@tux> <4DA496FA.3070908@fuzzy.cz> <8F22D592-23C1-4A3C-94A5-48363332ADD3@darkstatic.com> <4DA4BFA2.5060601@fuzzy.cz> <4DA4D40A.4010200@fuzzy.cz> <4DA56DA8020000250003C783@gw.wicourts.gov> <4DA6216E.9020907@fuzzy.cz> In-Reply-To: X-Enigmail-Version: 1.1.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=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201104/204 X-Sequence-Number: 43266 Dne 14.4.2011 01:10, Claudio Freire napsal(a): > On Thu, Apr 14, 2011 at 12:19 AM, Tomas Vondra wrote: >> >> Another issue is that when measuring multiple values (processing of >> different requests), the decisions may be contradictory so it really >> can't be fully automatic. >> > > I don't think it's soooo dependant on workload. It's dependant on > access patterns (and working set sizes), and that all can be > quantified, as opposed to "workload". Well, think about a database that's much bigger than the available RAM. Workload A: Touches just a very small portion of the database, to the 'active' part actually fits into the memory. In this case the cache hit ratio can easily be close to 99%. Workload B: Touches large portion of the database, so it hits the drive very often. In this case the cache hit ratio is usually around RAM/(size of the database). So yes, it may be very workload dependent. In the first case you may actually significantly lower the random_page_cost (even to seq_page_cost) and it's going to be quite fast (thanks to the cache). If you do the same thing with workload B, the database is going to burn. I'm not saying it's not possible to do some autotuning, but it's a bit tricky and it's not just about hardware. The workload *is* a very important part of the equation. But I have to admit this post probably sounds like an overengineering. If you can develop something simple (even if that does not consider workload at all), it might be a useful starting point. If I could help you in any way with this, let me know. regards Tomas