gpt4 book ai didi

postgresql - 如何转储不包括一个特定表的 postgres 数据库?

转载 作者:行者123 更新时间:2023-11-29 11:21:06 25 4
gpt4 key购买 nike

我想使用pg_dump 来备份postgres 数据库内容。我只想忽略包含数百 GB 缓存数据的特定表。

我如何使用 pg_dump 实现这一目标?

最佳答案

根据 the docs , --exclude-table 有一个选项,它通过匹配模式(即它允许通配符)从转储中排除表:

-T table --exclude-table=table Do not dump any tables matching the table pattern. The pattern is interpreted according to the same rules as for -t. -T can be given more than once to exclude tables matching any of several patterns.

When both -t and -T are given, the behavior is to dump just the tables that match at least one -t switch but no -T switches. If -T appears without -t, then tables matching -T are excluded from what is otherwise a normal dump.

有几个例子here .

关于postgresql - 如何转储不包括一个特定表的 postgres 数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31671244/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com