Administrative functions
Administration functions help you manage your service before and after recovery, as well as keeping track of your data
Administrative APIs help you prepare a database before and after a restore event. They also help you keep track of your TimescaleDB setup data.
Samples
Section titled “Samples”Prepare database for restore
Section titled “Prepare database for restore”Before restoring a database backup, prepare the database:
SELECT timescaledb_pre_restore();Then perform your restore operation:
psql -d your_database < backup.sqlComplete restore operation
Section titled “Complete restore operation”After restoring a database backup, complete the restore:
SELECT timescaledb_post_restore();View telemetry report
Section titled “View telemetry report”Check what telemetry data is being collected and sent:
SELECT get_telemetry_report();Full backup and restore workflow
Section titled “Full backup and restore workflow”Complete workflow for backing up and restoring a TimescaleDB database:
# On source databasepsql -d source_db -c "SELECT timescaledb_pre_restore();"pg_dump -Fc -f backup.dump source_db
# On target databasecreatedb target_dbpsql -d target_db -c "CREATE EXTENSION IF NOT EXISTS timescaledb;"psql -d target_db -c "SELECT timescaledb_pre_restore();"pg_restore -d target_db backup.dumppsql -d target_db -c "SELECT timescaledb_post_restore();"Check TimescaleDB version and installation
Section titled “Check TimescaleDB version and installation”Verify the TimescaleDB extension is installed and check version:
SELECT default_version, installed_versionFROM pg_available_extensionsWHERE name = 'timescaledb';
SELECT extversionFROM pg_extensionWHERE extname = 'timescaledb';Dump TimescaleDB meta data
Section titled “Dump TimescaleDB meta data”To help when asking for support and reporting bugs, TimescaleDB includes an SQL dump script. It outputs metadata from the internal TimescaleDB tables, along with version information.
This script is available in the source distribution in scripts/. To use it, run:
psql [your connect flags] -d your_timescale_db < dump_meta_data.sql > dumpfile.txtInspect dumpfile.txt before sending it together with a bug report or support question.
Available functions
Section titled “Available functions”get_telemetry_report(): view the background telemetry string sent to Timescaletimescaledb_post_restore(): perform required operations after finishing a database restoretimescaledb_pre_restore(): prepare the database for a restore operation