Re: Add shared buffer hits to pg_stat_io

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, smilingsamay(at)gmail(dot)com, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Lukas Fittl <lukas(at)fittl(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: Add shared buffer hits to pg_stat_io
Date: 2023-03-07 15:10:07
Message-ID: 647f549d-3ceb-6cbd-1b5a-d72370a1fb93@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 3/6/23 4:38 PM, Melanie Plageman wrote:
> Thanks for the review!
>
> On Tue, Feb 28, 2023 at 7:36 AM Drouvot, Bertrand
> <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>> BufferDesc *
>> LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
>> - bool *foundPtr, IOContext *io_context)
>> + bool *foundPtr, IOContext io_context)
>> {
>> BufferTag newTag; /* identity of requested block */
>> LocalBufferLookupEnt *hresult;
>> @@ -128,14 +128,6 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
>> hresult = (LocalBufferLookupEnt *)
>> hash_search(LocalBufHash, &newTag, HASH_FIND, NULL);
>>
>> - /*
>> - * IO Operations on local buffers are only done in IOCONTEXT_NORMAL. Set
>> - * io_context here (instead of after a buffer hit would have returned) for
>> - * convenience since we don't have to worry about the overhead of calling
>> - * IOContextForStrategy().
>> - */
>> - *io_context = IOCONTEXT_NORMAL;
>>
>>
>> It looks like that io_context is not used in LocalBufferAlloc() anymore and then can be removed as an argument.
>
> Good catch. Updated patchset attached.

Thanks for the update!

>
>>> While adding this, I noticed that I had made all of the IOOP columns
>>> int8 in the view, and I was wondering if this is sufficient for hits (I
>>> imagine you could end up with quite a lot of those).
>>>
>>
>> I think that's ok and bigint is what is already used for pg_statio_user_tables.heap_blks_hit for example.
>
> Ah, I was silly and didn't understand that the SQL type int8 is eight
> bytes and not 1. That makes a lot of things make more sense :)

Oh, I see ;-)

I may give it another review but currently V2 looks good to me.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-03-07 15:52:37 Re: Track IO times in pg_stat_io
Previous Message Mikhail Gribkov 2023-03-07 15:02:17 Re: GUC for temporarily disabling event triggers