I've been running a function on the database that is going into each table, ALTER COLUMN
on all columns of a certain data type, and CAST
to remove trailing zeros. About 115 tables varying from a few thousand records to a few hundred thousand records. It has been running for almost 24 hours and my approximate calculation until time of completion is about 58 hours.
I have htop
up and checking on it regularly.
I should mention this is a …
基本上,我正在尝试制作一个 SQL 转储来制作数据库的精确副本:用户定义的函数、关系、约束、表、数据等。
这是可行的pg_dump
还是psql
需要使用?
我一直在使用pg_dump -U user -cOx database > pg.sql
,但我并不完全清楚它是否捕获了所有内容。
我正在查看pg_dump
这里的所有标志:
https://www.postgresql.org/docs/11/app-pgdump.html
我能想到的唯一一个可能会这样做的,因为它并没有真正明确地说,是-s --schema-only
标志,它排除了数据。我对此很好,并pg_dump
为数据运行了一秒钟,但我主要想确保我正在备份用户定义的函数、关系等。