From: | Zhang Mingli <zmlpostgres(at)gmail(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de>, Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com> |
Cc: | Aleksander Alekseev <aleksander(at)timescale(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Summary function for pg_buffercache |
Date: | 2022-09-28 14:31:34 |
Message-ID: | 21c5aab5-f265-4308-978d-e960c85c37f5@Spark |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Regards,
Zhang Mingli
On Sep 28, 2022, 21:50 +0800, Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>, wrote:
> Hi all,
>
> The patch needed a rebase due to recent changes on pg_buffercache.
> You can find the updated version attached.
>
> Best,
> Melih
>
>
```
+
+ if (buffers_used != 0)
+ usagecount_avg = usagecount_avg / buffers_used;
+
+ memset(nulls, 0, sizeof(nulls));
+ values[0] = Int32GetDatum(buffers_used);
+ values[1] = Int32GetDatum(buffers_unused);
+ values[2] = Int32GetDatum(buffers_dirty);
+ values[3] = Int32GetDatum(buffers_pinned);
+
+ if (buffers_used != 0)
+ {
+ usagecount_avg = usagecount_avg / buffers_used;
+ values[4] = Float4GetDatum(usagecount_avg);
+ }
+ else
+ {
+ nulls[4] = true;
+ }
```
Why compute usagecount_avg twice?
From | Date | Subject | |
---|---|---|---|
Next Message | Melih Mutlu | 2022-09-28 14:41:45 | Re: Summary function for pg_buffercache |
Previous Message | Tom Lane | 2022-09-28 14:18:45 | Re: [PATCH] Introduce array_shuffle() and array_sample() |