pg_dump and pg_restore

PostgreSQL provides pg_dump and pg_restore. You can run pg_dump against current database, get a file with SQLs describe your database and use pg_restore to recreate.

If you migrate from PostgreSQL 13 to 14, it is better to use pg_dump and pg_restore from PostgreSQL 14.

Run it concurrently by --jobs option.