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 1paBXH-000239-SE for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Mar 2023 08:22:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1paBXG-0004mi-1H for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Mar 2023 08:22:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paBXF-0004mY-M1 for pgsql-hackers@lists.postgresql.org; Thu, 09 Mar 2023 08:22:01 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1paBXC-00073D-I3 for pgsql-hackers@postgresql.org; Thu, 09 Mar 2023 08:22:01 +0000 Received: by mail-wr1-x434.google.com with SMTP id l25so1021198wrb.3 for ; Thu, 09 Mar 2023 00:21:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678350117; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=KekM2mUoqCcGz6aBGt8ygo13hOdzRWTTyXqqq+Ys6xk=; b=RPQwhoQG8KU7/h/Hb0uAH9Z8bDayWSPRZNzEKMCpzsrHIz5oGWeHFpWdmYtv8unyPY WFr7d7pECG2e/g8lvjFrQtziTsAjyri6YRPbj1Oju70jVKGEsUX1Kj7L341DRl7hopO6 2rBwy2HNG7vxOpB60WHZipjU9po4N5Ut4vMC+4GLO6TPEOquX0nkFaRkqeP+k9I8wX6A y/tXBvdUraXV5305o+LPX+n48FJ8jC9bVDF1DXYFWtpQ3N2TfpynBmZJ3qP79mNQN+xb C1asqkLzj7Jt7wnjW1yOe2JuUmSkJ5nqKqSPYLR7DYoStyqyr+xjwmWwz7mvCjmJCbTy 5xDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678350117; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KekM2mUoqCcGz6aBGt8ygo13hOdzRWTTyXqqq+Ys6xk=; b=YTLKhR1oogBUqrnnb5K+v+X9f24QT4udB2NvSGGOy5ZI0+LVbJ2LduoljTCsuOUf8A b1CQA55gQ/zZfPj3QigXC/nYasf9N7FlrKJ+HK0G2/iTA4NXXdoqfQAi2JCwaEojpHy6 qafe+Opvbe9754I/ulexoicV5WVNiaHONrpviyPkOhEZLPej5VgAAAVw4OHoKawzTYL+ qchdDqqnB2McjpI+KwoVyfzFHBvUKe4eEbwC4x43KZ52QiNdWxZlEzBVNYzuMfaT4Nw0 jbw6QLCNFijcpF/aoPdmZSGDPPJToOcQCIQBaU5Z4TsLkbcGia/UnSYwEQyS418ysFS7 AS1Q== X-Gm-Message-State: AO0yUKWwmThMWa2v83mCJhepRS+twXzx0Wa+4PwCobTejELurGUNN+NG xFq3yi+l5s1bIvOpdj2FjqY= X-Google-Smtp-Source: AK7set+XjAonjCRksCqoPwlygUj38OEj0K5RdFoO2D3yZt+4V2G+JIAdxNuwA9q93mx3z0CUxdy/Vw== X-Received: by 2002:a5d:4ac9:0:b0:2c5:5ff8:93e5 with SMTP id y9-20020a5d4ac9000000b002c55ff893e5mr13984247wrs.44.1678350116625; Thu, 09 Mar 2023 00:21:56 -0800 (PST) Received: from [192.168.2.56] ([54.239.6.185]) by smtp.gmail.com with ESMTPSA id v11-20020a5d610b000000b002c5a790e959sm17168996wrt.19.2023.03.09.00.21.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Mar 2023 00:21:56 -0800 (PST) Message-ID: Date: Thu, 9 Mar 2023 09:20:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Track IO times in pg_stat_io To: Andres Freund Cc: Melanie Plageman , Pg Hackers , Maciek Sakrejda , Justin Pryzby , smilingsamay@gmail.com, Kyotaro Horiguchi , Lukas Fittl , Magnus Hagander , Alvaro Herrera References: <20230307184751.jdokdy2xmx3xpaua@awork3.anarazel.de> <7b450eef-8717-ce4a-a9c8-ccab24ecd89a@gmail.com> <20230309003438.rectf7xo7pw5t5cj@awork3.anarazel.de> Content-Language: en-US From: "Drouvot, Bertrand" In-Reply-To: <20230309003438.rectf7xo7pw5t5cj@awork3.anarazel.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 3/9/23 1:34 AM, Andres Freund wrote: > Hi, > > On 2023-03-08 12:55:34 +0100, Drouvot, Bertrand wrote: >> On 3/7/23 7:47 PM, Andres Freund wrote: >>> On 2023-03-07 13:43:28 -0500, Melanie Plageman wrote: >>> No, I don't think we can do that. It can be enabled on a per-session basis. >> >> Oh right. So it's even less clear to me to get how one would make use of those new *_time fields, given that: >> >> - pg_stat_io is "global" across all sessions. So, even if one session is doing some "testing" and needs to turn track_io_timing on, then it >> is even not sure it's only reflecting its own testing (as other sessions may have turned it on too). > > I think for 17 we should provide access to per-existing-connection pg_stat_io > stats, and also provide a database aggregated version. Neither should be > particularly hard. > +1 that would be great. > > I don't think it's particularly useful to use the time to calculate "per IO" > costs - they can vary *drastically* due to kernel level buffering. Exactly and I think that's the reason why it could be useful. I think that could help (with frequent enough sampling) to try to identify when the IOs are served by the page cache or not (if one knows his infra well enough). One could say (for example, depending on his environment) that if the read_time > 4ms then the IO is served by spindle disks (if any) and if <<< ms then by the page cache. What I mean is that one could try to characterized their IOs based on threshold that they could define. Adding/reporting histograms in the game would be even better: something we could look for for 17? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com