https://github.com/adjust/pg-mvtbl
A postgres Extension to easily move tables around tablespaces
https://github.com/adjust/pg-mvtbl
adjust-pg-extension
Last synced: 3 months ago
JSON representation
A postgres Extension to easily move tables around tablespaces
- Host: GitHub
- URL: https://github.com/adjust/pg-mvtbl
- Owner: adjust
- Created: 2018-01-13T19:22:26.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-06-26T08:59:19.000Z (12 months ago)
- Last Synced: 2025-06-26T09:44:15.761Z (12 months ago)
- Topics: adjust-pg-extension
- Language: PLpgSQL
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 19
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README

# mvtbl
A postgres Extension to easily move tables around tablespaces
The function mvtbl(tablname, tablespace ) moves a table `tablname`
along with all indexes to the tablespace `tablespace` and returns
the moved data size in bytes.
### Usage
see test/expected/mvtbl.out for examples
```SQL
SELECT pg_size_pretty(mvtbl('test','mvtbl_test_tblspace'));
pg_size_pretty
----------------
123 MB
(1 row)
SELECT pg_size_pretty(mvtbl('public.test','pg_default'));
pg_size_pretty
----------------
123 MB
(1 row)
```
### Installation
```shell
$ make install
```
```SQL
CREATE EXTENSION mvtbl;
```