我有一个相当大的数据库(15G+压缩的),它是这样创建的:
pg_dump wrwks_prod -Fc -f /path/to/file.dump并恢复到这样的远程主机上:
pg_restore --no-owner --clean --dbname=dbname --username=user --host=remote_host --port=port -j 3 --v /path/to/file.dump但是,当我检查远程机器时,只有一个进程使用一个核心来创建索引,因此忽略了作业参数。
这是什么原因?
本地和远程机器都使用Postgres 9.2运行。
发布于 2018-04-11 07:29:50
我假设你有一张大桌子,上面有一个巨大的索引,所以并行的工作很快就恢复了所有其他的小关系。索引生成无法在表完全恢复之前启动,因此它将等待它。一旦一个表被恢复,一个巨大的索引就会被创建.当然这是假设..。试着跑步,就像:
SELECT oid, row_estimate, total_bytes
,pg_size_pretty(total_bytes) AS total
, pg_size_pretty(index_bytes) AS INDEX
, pg_size_pretty(toast_bytes) AS toast
, pg_size_pretty(table_bytes) AS tbl
FROM (
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (
SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME
, c.reltuples AS row_estimate
, pg_total_relation_size(c.oid) AS total_bytes
, pg_indexes_size(c.oid) AS index_bytes
, pg_total_relation_size(reltoastrelid) AS toast_bytes
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE relkind = 'r'
) a
) a
order by "total_bytes" desc
limit 10
;确认或忽略该假设
https://stackoverflow.com/questions/49755986
复制相似问题