Top
Enterprise Postgres 18 Knowledge DataManagement FeatureUser's Guide

5.4.1 Backup/Restore

All data saved in the tables created by this feature will be subject to backup. For the tables created by this feature and the data saved in them, refer to "5.5.2 Tables/Views".

Files generated in the directory set in pgx_inference.triton_model_repository_path parameter do not need to be backed up. This is because these files are created based on the data stored in the table each time the model is loaded.

If the restore destination instance or database is using this feature, you need to unload and delete the models used in the restore destination instance or database from the inference server before performing the restore. Follow the procedures described in "5.2.3 Removing" to unload and delete all models.

When restoring backup data created by the pg_dump command or the pg_dumpall command, perform it on a database that is not using this feature. If the target database for restoration already has a model imported, restoration may not be possible. The procedures for restore varies depending on whether or not the semantic text search and the automatic vectorization feature are used.

When using semantic text search and the automatic vectorization feature

Backups are obtained using the pg_dump command. You cannot restore using a backup obtained with the pg_dumpall command.

When performing a restore, the parameters listed in "5.2.2 Setting Up pgx_inference" must be set on the instance where the restore is being performed. Additionally, restore separately for each schema where extensions are created.

  1. Obtain a backup using the pg_dump command.
    Since the model file is saved as a large object, explicitly specify the -b(--large-objects) option.

    Example)

    pg_dump -U postgres -d olddb -b -Fc -v -f ./backup_file.dmp
  2. Restore only definitions with the --schema-only option of the pg_restore command.

    Example)

    pg_restore -U postgres -d newdb --schema-only ./backup_file.dmp
  3. Restore data other than pgai and pgx_vectorizer using the pg_restore command.

    Example)

    pg_restore --exclude-schema=ai --exclude-schema=pgx_vectorizer --data-only -d newdb ./backup_file.dmp
  4. Disable triggers to avoid unique constraint violations with the pg_restore command, and restore the data for pgai and pgx_vectorizer.

    Example)

    pg_restore --schema=ai --schema=pgx_vectorizer --data-only -d newdb --disable-triggers ./backup_file.dmp

When not using semantic text search and the automatic vectorization feature

Use the backup obtained with the pg_dump command to restore with the pg_restore command.
Since model files are saved as large objects, explicitly specify the -b (--large-objects) option of the pg_dump command. When performing a restore, the parameters listed in "5.2.2 Setting Up pgx_inference" must be set on the instance where the restore is being performed.

Example)

pg_dump -U postgres -d olddb -b -Fc -v -f ./backup_file.dmp
pg_restore -d newdb ./backup_file.dmp


Additionally, you can use the backup obtained with the pg_dumpall command to restore with the psql command.

Example) Backup the instance to be backed up using the pg_dumpall command

pg_dumpall -U postgres > pg_dumpall.sql

Example) Execute a restore on the instance to be restored

psql -U postgres -f pg_dumpall.sql