{"repo":"cybertec-postgresql/pg_rewrite","free":true,"listed":false,"github":"https://github.com/cybertec-postgresql/pg_rewrite","clone":"git clone https://github.com/cybertec-postgresql/pg_rewrite.git","description":"Perform maintenance tasks which require a table to be rewritten (i.e. the table data to be copied to a new storage) and which are expected to limit the access to the table as little as possible","language":"C","stars":46,"topics":["postgresql-extension","postgresql"],"license":null,"category":"databases-storage","readme_excerpt":"pg rewrite pg rewrite is a tool to rewrite table (i.e. to copy its data to a new file). It allows both read and write access to the table during the rewriting. Following are the most common reasons to rewrite a table: 1. Change data type of column(s) Typically this is needed if the existing data type is running out of values. For example, you may need to change interger type to bigint . ALTER TABLE command can do that too, but it allows neither write nor read access to the table during the rewriting. 2. Partition the table If you realize that your table is getting much bigger than expected and that partitioning would make your life easier, the next question may be how to copy the existing data to the new, partitioned table without stopping all the applications that run DML commands on the table. (When you decide to use partitioning, the amount of data to copy might already be significant, so the copying might need a while.) 3. Change order of columns If you conclude that a different order of columns would save significant disk space (due to reduced paddding), the problem boils down to copying data to a new table like in 2). Again, you may need pg rewrite to make the change smooth. 4. Move table into another tablespace. ALTER TABLE command can do that, but it allows neither write nor read access to the table during the rewriting. With pg rewrite , you only need to create the new table in the desired tablespace. The rest is identical to the other use cases. Note that the follow","default_branch":null,"files":null,"tree":[],"storefront":"/r/cybertec-postgresql","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/cybertec-postgresql/pg_rewrite/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}