-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: queries related to lsn updated
Signed-off-by: Emanuel Calvo <3manuek@gmail.com>
- Loading branch information
Showing
4 changed files
with
17 additions
and
3 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
-- Given the current xlog location, it calculates the size of the current active WAL | ||
-- Source: https://www.cybertec-postgresql.com/en/checkpoint-distance-and-amount-of-wal/ | ||
SELECT pg_size_pretty(pg_current_xlog_location() - '0/00000000'::pg_lsn); | ||
-- Amount of generated WALS so far | ||
SELECT pg_size_pretty(pg_current_wal_lsn() - '0/00000000'::pg_lsn); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Given the current xlog location, it calculates the size of the current active WAL | ||
-- Source: https://www.cybertec-postgresql.com/en/checkpoint-distance-and-amount-of-wal/ | ||
SELECT pg_size_pretty(pg_current_xlog_location() - '0/00000000'::pg_lsn); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Current amount of WALs present in the waldir | ||
WITH oldest_mod_walfile AS ( | ||
SELECT (substring(name from 9 for 8) || '/' || substring(name from 17 for 8 ))::pg_lsn as oldest_lsn | ||
FROM pg_ls_waldir() | ||
ORDER BY modification DESC LIMIT 1 | ||
) | ||
SELECT pg_size_pretty(pg_wal_lsn_diff( pg_current_wal_lsn(),oldest_lsn)) | ||
FROM oldest_mod_walfile; | ||
|
||
|
||
|
||
|