X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 25880567F0 for ; Wed, 16 Mar 2005 18:04:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78889-05 for ; Wed, 16 Mar 2005 18:04:15 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 918CE567CD for ; Wed, 16 Mar 2005 18:04:15 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7134689; Wed, 16 Mar 2005 10:06:06 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Greg Stark Subject: Re: cpu_tuple_cost Date: Wed, 16 Mar 2005 10:03:10 -0800 User-Agent: KMail/1.6.2 Cc: David Brown , Gregory Stark References: <87psy1mq66.fsf@stark.xeocode.com> <42377293.1010801@bigpond.net.au> <87acp4kq9o.fsf@stark.xeocode.com> In-Reply-To: <87acp4kq9o.fsf@stark.xeocode.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200503161003.10916.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/330 X-Sequence-Number: 11035 Greg, > So 800kB/s for random access reads. And 40Mb/s for sequential reads. That's > a factor of 49. I don't think anyone wants random_page_cost to be set to 50 > though. > > For a high end 15k drive I see average seek times get as low as 3ms. And > sustained transfer rates get as high as 100Mb/s. So about 2.7Mb/s for > random access reads or about a random_page_cost of 37. Still pretty > extreme. Actually, what you're demonstrating here is that there's really no point in having a random_page_cost GUC, since the seek/scan ratio is going to be high regardless. Although I can point out that you left out the fact that the disk needs to do a seek to find the beginning of the seq scan area, and even then some file fragmentation is possible. Finally, I've never seen PostgreSQL manage more than 70% of the maximum read rate, and in most cases more like 30%. > So what's going on with the empirically derived value of 4? It's not empirically derived; it's a value we plug into an internal-to-postgresql formula. And "4" is a fairly conservative value that works for a lot of systems. Realistically, the values we should be deriving from are: -- median file cache size for postgresql files -- average disk read throughput -- effective processor calculation throughput -- median I/O contention However, working those 4 hardware "facts" into forumulas that allow us to calculate the actual cost of a query execution plan is somebody's PhD paper. -- Josh Berkus Aglio Database Solutions San Francisco