{"id":19458504,"url":"https://github.com/postgrespro/pg_pageprep","last_synced_at":"2025-04-25T06:30:28.335Z","repository":{"id":50117479,"uuid":"105665706","full_name":"postgrespro/pg_pageprep","owner":"postgrespro","description":"PostgreSQL extension which helps to prepare heap pages for migration to 64bit XID page format (PostgresPro Enterprise)","archived":false,"fork":false,"pushed_at":"2019-05-31T11:02:55.000Z","size":463,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-24T10:48:42.717Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postgrespro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-03T15:04:18.000Z","updated_at":"2023-03-06T05:21:51.000Z","dependencies_parsed_at":"2022-09-12T08:40:46.470Z","dependency_job_id":null,"html_url":"https://github.com/postgrespro/pg_pageprep","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fpg_pageprep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fpg_pageprep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fpg_pageprep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fpg_pageprep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postgrespro","download_url":"https://codeload.github.com/postgrespro/pg_pageprep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250766957,"owners_count":21483894,"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":[],"created_at":"2024-11-10T17:27:22.927Z","updated_at":"2025-04-25T06:30:28.011Z","avatar_url":"https://github.com/postgrespro.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/postgrespro/pg_pageprep.svg?branch=master)](https://travis-ci.org/postgrespro/pg_pageprep)\n[![GitHub license](https://img.shields.io/badge/license-PostgreSQL-blue.svg)](https://raw.githubusercontent.com/postgrespro/pg_pageprep/master/LICENSE)\n\n# pg_pageprep\n\n**WIP**\n\n`pg_pageprep` is an extension that is supposed to help to prepare heap pages\nfor migration to 64bit XID page format.\n\nPostgresPro Enterprise page format reqiures extra 20 bytes per page compared\nto original PostgreSQL in order to support 64bit transaction IDs. The idea\nbehind this extension is to prepare enough space in pages for new format\nwhile database is working on vanilla postgres.\n\n# Compatibility\n\n`pg_pageprep` provides possibility to migrate data to PostgresPro Enterpise 11\nfrom the following versions:\n* PostgreSQL 10 and 11;\n* PostgresPro Standard 10 and 11.\n\n# Installation\n\n```\nmake install USE_PGXS=1\n```\n\nor if postgres binaries are not on PATH\n\n```\nmake install USE_PGXS=1 PG_CONFIG=/path/to/pg_config\n```\n\nAdd `pg_pageprep` to `shared_preload_libraries` parameter in `postgresql.conf`:\n\n```\nshared_preload_libraries='pg_pageprep'\n```\n\nIt is required to restart PostgreSQL cluster in order to apply new configuration. After that perform `CREATE EXTENSION pg_pageprep;` on each database in cluster.\n\n# Configuration\n\nYou can add the following parameters to your postgres config:\n\n* `pg_pageprep.database` - database name, which starter process will use to get databases list (default 'postgres');\n* `pg_pageprep.role` - user name (default 'postgres');\n* `pg_pageprep.per_page_delay` - delay between consequent page scans in milliseconds (default 10 ms);\n* `pg_pageprep.per_relation_delay` - delay b/w relations scans in milliseconds (default 0 ms);\n* `pg_pageprep.per_attempt_delay` - delay b/w attempts to scan next relation in case previous attempt was unsuccessful, e.g. there are all relations are already done (default 60 s).\n\n# Usage\n\n## Python script\n\n```\npython pg_pageprep_manager.py -d \u003cdatabase\u003e -U \u003cusername\u003e \u003ccommand\u003e\n```\n\nwhere `\u003cdatabase\u003e` is a database used to get the list of all databases in cluster, `\u003cusername\u003e` is a user name on whose behalf the script will work and `command` is one of the following:\n\n* install - creates extension on each existing database, sets pg_pageprep.databases and pg_pageprep.role parameters to config (ALTER SYSTEM). Note that background workers will start automatically after next cluster restart.\n* start - starts background workers right away; note that during its works background worker sets fillfactor to 90% (if needed) for every relation it processes;\n* stop - stops background workers;\n* status - shows information about current workers activity and relations to be processed;\n* restore - stop workers (if any) and restore original fillfactor (this is usually need to be done once after pg_upgrade).\n\nExample:\n\n```\npython pg_pageprep_manager.py -d postgres -U my_username status\n```\n\n\u003e **Note:** If psql isn't on your path you'll need to pass `pgpath` (`b`) option:\n\u003e `python pg_pageprep_manager.py -d postgres -U my_username -b /path/to/bin/dir status`\n\n## plpgsql\n\nPerform on every database in cluster.\n\n```\nCREATE EXTENSION pg_pageprep;\nSELECT start_bgworker();\n```\n\nNote that during its works background worker sets fillfactor to 90% (if needed) for every relation it processes.\nTo check todo list use `pg_pageprep_todo` view:\n\n```\nSELECT * FROM pg_pageprep_todo;\n```\n\nThe empty list means that everything is done and database is ready for pg_upgrade.\nTo view current workers status use function `get_workers_list()`:\n\n```\nSELECT * FROM get_workers_list();\n\n database | status\n----------+--------\n postgres | active\n(1 row)\n\n```\n\nUse following function to stop background worker:\n\n```\nSELECT stop_bgworker();\n```\n\nThis only stops worker on current database.\nAfter pg_upgrade run the following command to restore fillfactors to original values:\n\n```\nSELECT restore_fillfactors()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrespro%2Fpg_pageprep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostgrespro%2Fpg_pageprep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrespro%2Fpg_pageprep/lists"}