{"id":20441475,"url":"https://github.com/moritetu/walreader","last_synced_at":"2025-09-24T14:31:40.796Z","repository":{"id":85122595,"uuid":"210637898","full_name":"moritetu/walreader","owner":"moritetu","description":"a postgresql  extension to read wal with sql functions","archived":false,"fork":false,"pushed_at":"2019-10-06T07:34:34.000Z","size":36,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-15T09:47:09.947Z","etag":null,"topics":["extension","postgresql","walreader"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moritetu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-24T15:34:00.000Z","updated_at":"2024-10-13T15:07:04.000Z","dependencies_parsed_at":"2023-07-21T19:45:50.884Z","dependency_job_id":null,"html_url":"https://github.com/moritetu/walreader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritetu%2Fwalreader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritetu%2Fwalreader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritetu%2Fwalreader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moritetu%2Fwalreader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moritetu","download_url":"https://codeload.github.com/moritetu/walreader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234089066,"owners_count":18778013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extension","postgresql","walreader"],"created_at":"2024-11-15T09:33:06.449Z","updated_at":"2025-09-24T14:31:35.503Z","avatar_url":"https://github.com/moritetu.png","language":"C","readme":"walreader\n=========\n\nwalreader is a postgresql extension to read wal records with sql function. This extension will help you to study wal internal structure.\n\nwalreader was created with reference to pg_waldump. pg_waldump will be lighter, more feature rich and easier to use.\n\nInstallation\n------------\n \n You can install walreader extension with the following commands.\n \n ```bash\n $ git clone https://github.com/moritetu/walreader.git\n $ cd walreader\n $ make USE_PGXS=1 install\n ```\n \n Next, log in a database and install the extension with `CREATE EXTENSION` command.\n \n ```\n postgres=# CREATE EXTENSION walreader;\n ```\n \nSettings\n--------\n\n### walreader.default_wal_directory\n\nSpecifies the directory where we read wal segment files. Default is `XLOGDIR`, which means `pg_wal` in version 10 or later.\n\nYou can switch value of this parameter in session.\n\n```\npostgres=# set walreader.default_wal_directory to '/path/to/waldir';\n```\n\n### walreader.read_limit\n\nMaximum number of records to read. Default is `0` and it means no limit.\n\nYou can specify in the range of `0` to `INT_MAX`.\n\n \nUsage\n-----\n\n### Read wal records from segment file\n\n**SQL Function**\n\n```\nread_wal_segment(start_wal_segment [, end_wal_segment [, wal_directory]]);\n```\n\n**Example**\n\n```sql\npostgres=# select * from read_wal_segment('000000010000000000000004');\n timeline |          walseg          | seg_off | page | page_off |    rmgr     | rec_len | tot_len | tx  |    lsn     |  prev_lsn  |      identify       |                                                                                                   rmgr_desc                                                                                                   \n----------+--------------------------+---------+------+----------+-------------+---------+---------+-----+------------+------------+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n        1 | 000000010000000000000004 |      40 |    1 |       40 | Standby     |      50 |      50 |   0 | 0/04000028 | 0/03000110 | RUNNING_XACTS       | nextXid 488 latestCompletedXid 487 oldestRunningXid 488\n        1 | 000000010000000000000004 |      96 |    1 |       96 | Standby     |      50 |      50 |   0 | 0/04000060 | 0/04000028 | RUNNING_XACTS       | nextXid 488 latestCompletedXid 487 oldestRunningXid 488\n        1 | 000000010000000000000004 |     152 |    1 |      152 | XLOG        |     114 |     114 |   0 | 0/04000098 | 0/04000060 | CHECKPOINT_ONLINE   | redo 0/4000028; tli 1; prev tli 1; fpw true; xid 0:488; oid 24576; multi 1; offset 0; oldest xid 479 in DB 1; oldest multi 1 in DB 1; oldest/newest commit timestamp xid: 0/0; oldest running xid 488; online\n        1 | 000000010000000000000004 |     272 |    1 |      272 | Standby     |      50 |      50 |   0 | 0/04000110 | 0/04000098 | RUNNING_XACTS       | nextXid 488 latestCompletedXid 487 oldestRunningXid 488\n        1 | 000000010000000000000004 |     328 |    1 |      328 | Heap        |      54 |     150 | 488 | 0/04000148 | 0/04000110 | INSERT              | off 2 flags 0x00\n        1 | 000000010000000000000004 |     480 |    1 |      480 | Transaction |      34 |      34 | 488 | 0/040001E0 | 0/04000148 | COMMIT              | 2019-09-15 11:56:40.963685+09\n        1 | 000000010000000000000004 |     520 |    1 |      520 | Standby     |      50 |      50 |   0 | 0/04000208 | 0/040001E0 | RUNNING_XACTS       | nextXid 489 latestCompletedXid 488 oldestRunningXid 489\n        1 | 000000010000000000000004 |     576 |    1 |      576 | XLOG        |     114 |     114 |   0 | 0/04000240 | 0/04000208 | CHECKPOINT_SHUTDOWN | redo 0/4000240; tli 1; prev tli 1; fpw true; xid 0:489; oid 24576; multi 1; offset 0; oldest xid 479 in DB 1; oldest multi 1 in DB 1; oldest/newest commit timestamp xid: 0/0; oldest running xid 0; shutdown\n        1 | 000000010000000000000004 |     696 |    1 |      696 | Standby     |      50 |      50 |   0 | 0/040002B8 | 0/04000240 | RUNNING_XACTS       | nextXid 489 latestCompletedXid 488 oldestRunningXid 489\n        1 | 000000010000000000000004 |     752 |    1 |      752 | XLOG        |      24 |      24 |   0 | 0/040002F0 | 0/040002B8 | SWITCH              | \n(10 rows)\n\npostgres=# select * from read_wal_segment(pg_walfile_name(pg_current_wal_lsn())) limit 1;\nWARNING:  invalid record length at 0/135D60E0: wanted 24, got 0\n timeline |          walseg          | seg_off | page | page_off |  rmgr   | rec_len | tot_len | tx |    lsn     |  prev_lsn  |   identify    |                        rmgr_desc                        \n----------+--------------------------+---------+------+----------+---------+---------+---------+----+------------+------------+---------------+---------------------------------------------------------\n        1 | 000000010000000000000013 |      40 |    1 |       40 | Standby |      50 |      50 |  0 | 0/13000028 | 0/12488EA0 | RUNNING_XACTS | nextXid 537 latestCompletedXid 536 oldestRunningXid 537\n(1 row)\n\n```\n \n### Read wal records with lsn\n\n**SQL Function**\n\n```\nread_wal_lsn(start_wal_lsn [, end_wal_lsn [, wal_directory]]);\n```\n\n**Example**\n\n```sql\n postgres=# select * from read_wal_lsn('0/04000208');\n timeline |          walseg          | seg_off | page | page_off |  rmgr   | rec_len | tot_len | tx |    lsn     |  prev_lsn  |      identify       |                                                                                                   rmgr_desc                                                                                                   \n----------+--------------------------+---------+------+----------+---------+---------+---------+----+------------+------------+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n        1 | 000000010000000000000004 |     520 |    1 |      520 | Standby |      50 |      50 |  0 | 0/04000208 | 0/040001E0 | RUNNING_XACTS       | nextXid 489 latestCompletedXid 488 oldestRunningXid 489\n        1 | 000000010000000000000004 |     576 |    1 |      576 | XLOG    |     114 |     114 |  0 | 0/04000240 | 0/04000208 | CHECKPOINT_SHUTDOWN | redo 0/4000240; tli 1; prev tli 1; fpw true; xid 0:489; oid 24576; multi 1; offset 0; oldest xid 479 in DB 1; oldest multi 1 in DB 1; oldest/newest commit timestamp xid: 0/0; oldest running xid 0; shutdown\n        1 | 000000010000000000000004 |     696 |    1 |      696 | Standby |      50 |      50 |  0 | 0/040002B8 | 0/04000240 | RUNNING_XACTS       | nextXid 489 latestCompletedXid 488 oldestRunningXid 489\n        1 | 000000010000000000000004 |     752 |    1 |      752 | XLOG    |      24 |      24 |  0 | 0/040002F0 | 0/040002B8 | SWITCH              | \n(4 rows)\n\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoritetu%2Fwalreader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoritetu%2Fwalreader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoritetu%2Fwalreader/lists"}