Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nw36c-0003uL-5k for pgsql-admin@arkaria.postgresql.org; Tue, 31 May 2022 14:44:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nw36b-0007e0-1H for pgsql-admin@arkaria.postgresql.org; Tue, 31 May 2022 14:44:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nw36a-0007dh-N5 for pgsql-admin@lists.postgresql.org; Tue, 31 May 2022 14:44:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nw36Y-0008Bh-Ds for pgsql-admin@postgresql.org; Tue, 31 May 2022 14:44:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 24VEiEIh175812; Tue, 31 May 2022 10:44:14 -0400 From: Tom Lane To: Laurenz Albe cc: Jeff Janes , jian xu , "pgsql-admin@postgresql.org" Subject: Re: how to calibrate the cost model parameters In-reply-to: <1ec517a25fd893f783e3bd4606eccf036b0c6696.camel@cybertec.at> References: <68bd3f240bc5792eb098418656445c3ebd0488c5.camel@cybertec.at> <1ec517a25fd893f783e3bd4606eccf036b0c6696.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Tue, 31 May 2022 08:46:29 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <175810.1654008254.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 31 May 2022 10:44:14 -0400 Message-ID: <175811.1654008254@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe writes: > I think that the values of those parameters are more set by experience a= nd tradition than > by measurable physical evidence. In a way, it just happens to work (mos= tly). > For example, who says that on a spinning disk, random I/O is four times = as slow as > sequential I/O? Very likely, you have to factor in that part of the I/O= requests are > satisfied from the kernel page cache. The 4.0 value *is* based on some real evidence --- many years ago, I put in a lot of machine time to get an estimate of that for non-cached fetches on the hardware I was using at the time. If somebody did that over again today, they'd likely get a somewhat different value, even assuming they were still using spinning-rust storage. But it doesn't matter too much. A value around that is probably fine for rotating storage, while if you are using SSD it's likely better to use something around 1.0, and beyond that any inaccuracies in the cost constants are usually swamped by imperfections of the cost models and other data. For instance, it's not that useful to sweat about what the right value is for cpu_operator_cost when we've never spent any serious effort on assigning plausible procost factors to different functions. (Worse, the whole notion that a given function has a fixed cost independent of its input data is sadly inadequate.) regards, tom lane