Subject: No. Of wal files generated

From: Atul Kumar <[email-masked]>
Date: Fri, 7 Mar 2025 21:29:06 +0530

Hi,

Please could you help me by sharing any redhat linux command through which
I can count the no. of wal files and no. of ".ready" files generated in
last 10 minutes.

Regards,
Atul

---

From: Ron Johnson <[email-masked]>
Date: Fri, 7 Mar 2025 12:15:13 -0500

> I can count the no. of wal files and no. of ".ready" files generated in

What problem are you trying to solve?

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

---

From: Atul Kumar <[email-masked]>
Date: Sat, 8 Mar 2025 01:16:53 +0530

I want to check and compare the speed  wal file generation process and
archival process.

So I want to check how many wal file got created in x minutes and how many
.ready files got created in those x minutes.

Regards,
Atul

On Fri, 7 Mar 2025, 22:45 Ron Johnson, <[email-masked]> wrote:

>> Please could you help me by sharing any redhat linux command through
>> which I can count the no. of wal files and no. of ".ready" files generated
>> in last 10 minutes.
>>
>

---

From: Ron Johnson <[email-masked]>
Date: Fri, 7 Mar 2025 15:07:12 -0500

inotifywait can log every file creation and deletion in a directory.

Honestly, though, I'd strongly think about using PgBackRest instead of
something you wrote yourself.

---

From: Atul Kumar <[email-masked]>
Date: Sat, 8 Mar 2025 06:23:25 +0530

Please can you elaborate more about the meaning of inotifywait.

And how pgbackrest will solve the issue ?

Regards.

On Sat, 8 Mar 2025, 01:37 Ron Johnson, <[email-masked]> wrote:

>> So I want to check how many wal file got created in x minutes and how
>> many .ready files got created in those x minutes.
>>
>>
>>
>> Regards,
>> Atul
>>

---

From: Greg Sabino Mullane <[email-masked]>
Date: Fri, 7 Mar 2025 22:34:22 -0500

Take a look at the pg_stat_archiver view, if you have not already:

https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ARCHIVER-VIEW

> .ready files got created in those x minutes.

It's not clear why you would want to track .ready files, they should be
quite transient, and not a concern unless you are rolling your own
archiving system (which you should not be). But Ron's suggestion of
inotifywait is a good one for this. Probably listed as inotify or
inotify-tools in your packaging system. Basic usage would be something like
this, from the data directory:

timeout 10m inotifywait pg_wal/ -r -m -e close_write -o walinfo.log

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

---

From: Achilleas Mantzios - cloud <[email-masked]>
Date: Mon, 10 Mar 2025 09:41:38 +0200

On 3/7/25 17:59, Atul Kumar wrote:
> which I can count the no. of wal files and no. of ".ready" files 
> generated in last 10 minutes.

Do you have wal archiving enabled? If yes, then simply go to the archive 
dir and suit your self with

find , ls, grep, awk, sort , unic -c , etc .

Find files created in the last 10 mins :

find -cmin 10

to get statistics over time :

***CLOUD*** jboss@sma:/smadb/smadb/pgsql/pitr$ ls -lt | head -10
total 629962796
-rw------- 1 postgres postgres 16777216 Mar 10 09:32 
000000010000472D00000078
-rw------- 1 postgres postgres 16777216 Mar 10 09:32 
000000010000472D00000077
-rw------- 1 postgres postgres 16777216 Mar 10 09:32 
000000010000472D00000076
-rw------- 1 postgres postgres 16777216 Mar 10 09:32 
000000010000472D00000075

...

you may use :

ls -lt | awk '{print $6""$7"_"substr($8,1,2) }' | sort | uniq -c | less

to get the distribution over (group by) 1 hour intervals