{"id":14974025,"url":"https://github.com/adyen/adyen-postgres-partitioning","last_synced_at":"2025-10-27T05:31:26.914Z","repository":{"id":197005181,"uuid":"645827173","full_name":"Adyen/adyen-postgres-partitioning","owner":"Adyen","description":"Functions to manage partitions in PostgreSQL with minimal impact for applications","archived":false,"fork":false,"pushed_at":"2023-12-15T05:28:01.000Z","size":34,"stargazers_count":50,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-02-06T22:21:36.987Z","etag":null,"topics":["database","database-maintenance","database-management","foreign-keys","functions","index","partitioning","plpgsql","plpgsql-function","plpgsql-language","postgres","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Adyen.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-05-26T14:22:56.000Z","updated_at":"2025-02-03T17:39:40.000Z","dependencies_parsed_at":"2023-12-19T04:22:26.227Z","dependency_job_id":"898e9a49-f982-4fd9-90d4-9d72ce730b7b","html_url":"https://github.com/Adyen/adyen-postgres-partitioning","commit_stats":{"total_commits":5,"total_committers":3,"mean_commits":"1.6666666666666667","dds":0.4,"last_synced_commit":"110a6c55676e1eedc56d02b15bb12f043b8599fa"},"previous_names":["adyen/adyen-postgres-partitioning"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adyen%2Fadyen-postgres-partitioning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adyen%2Fadyen-postgres-partitioning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adyen%2Fadyen-postgres-partitioning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adyen%2Fadyen-postgres-partitioning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Adyen","download_url":"https://codeload.github.com/Adyen/adyen-postgres-partitioning/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238445839,"owners_count":19473821,"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":["database","database-maintenance","database-management","foreign-keys","functions","index","partitioning","plpgsql","plpgsql-function","plpgsql-language","postgres","postgresql","sql"],"created_at":"2024-09-24T13:49:50.511Z","updated_at":"2025-10-27T05:31:26.584Z","avatar_url":"https://github.com/Adyen.png","language":"PLpgSQL","readme":"# adyen-postgres-partitioning\nThese functions are designed to create and maintain partitions in PostgreSQL with a minimal impact on the applicaton. The priority is to not impact the application. When multiple options are available the weakest lock possible is being used, when a heavy lock is required we use a timeout to prevent long lasting locks.\n\nEvery function in this project starts with a detailed comment on what the function does and how to use it.\n\n## Contributing\nWe strongly encourage you to contribute to our repository. Find out more in our [contribution guidelines](https://github.com/Adyen/.github/blob/master/CONTRIBUTING.md)\n\n## Requirements\nAll function have been tested on postgres 13.\n\n## Installation\nAll function will be installed in the DBA schema. If you don't have this schema yet, create it by running sql/schema/schema.sql.\n\nYou can add the individual functions directly on the database from `psql` with the `\\i` command. Use `psql` to login on your database and run\n```sql\n\\i \u003cfull path to the function\u003e.\u003cfilename\u003e.sql\n```\nN.B. Some functions use other functions and the script `partition_maintenance.sql` requires a set of tables to be created.\n\n### Install all functions\nTo create all the functions and the tables required to configure maintenance apply the following scripts in order from the root directory of the project\nsql/schema/schema.sql\nsql/tables/tables.sql\nsql/functions/create_all_functions.sql\n\n### Test functions\nTo test all functions run the following scripts from the project root folder\ntest/tables.sql\ntest/run_functions.sql\ntest/configuration.sql\ntest/cleanup.sql\n\n## Usage\nThe functions can be called as any other postgres function\n```sql\nselect dba.\u003cfunction_name\u003e(arg1, arg2, ..., argN);\n```\n\n## Documentation\nThe functions in this project can\n\n- Partition an existing table. The origional table will not partitioned itself, but becomes the first partition\n- Add indexes to a partitioned table and all children\n- Add foreign keys to a partitioned table and all children\n- Add date constraints to a table partitioned on an integer column\n- Count the number of available, unused partitions\n- Get the details for the last partition\n- Add new partitions to a partitioned table. The new partitions will have the same properties as the latest available partition\n- Detach partitions from a partitioned table\n- Drop detached partitions\n\nBesides all the functions the project also contains the script `partition_maintenance.sql`. This scripts requires two tables being created\n- dba.partition_configuration\n- dba.detached_partitions\n\nThe scripts performs the following tasks based on the configuration in the table `dba.partition_configuration`. \n- Add new partitions\n- Add date constraints\n- Detach partitions\n- Drop detached partitions after a cool-down period\n\nSee the documentation within sql/tables/tables.sql for the configuration details. \n\n## Support\nIf you have a feature request, or spotted a bug or a technical problem, create a GitHub issue.\n\n## License\nMIT license. For more information, see the LICENSE file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadyen%2Fadyen-postgres-partitioning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadyen%2Fadyen-postgres-partitioning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadyen%2Fadyen-postgres-partitioning/lists"}