PostgreSQL数据库设计跨多个磁盘

huangapple go评论42阅读模式
英文:

PostgreSQL database design on multiple disks

问题

我有一台物理机,上面有几块SSD硬盘和全新安装的PostgreSQL:我将在几个不同的表中加载大约1-2TB的数据(它们之间没有互联),每个表包含不同的数据实体。

我在考虑两种方法:

  1. 为每个实体的数据创建一个数据库(具有相应的数据实体表)。
  2. 创建一个数据库,但将每个数据实体的表存储在不同的硬盘上。

因此,我的问题如下:哪种方法更受推荐,哪种方法成本较低?

英文:

Currently I've one physical machine with few SSD disks and PostgreSQL fresh installation: I'll load ~1-2Tb of data in few distinct tables (they've not interconnection between themselves) where each table comprises distinct data entity.

I am thinking about two approaches:

  1. Create DB (with corresponding table for data entity) on each disk for each entity.
  2. Create one DB but store each table for corresponding data entity on separate disks.

So, my questions are as follows: what approach is preferred and which can be achieved with less cost?

答案1

得分: 2

  • 这些数据是否由同一应用程序使用?
  • 这些表中的数据是否连接在一起?
  • 这些表是否应始终同时启动和停止,并且具有相同的PostgreSQL版本?

如果是,那么最好将它们一起存储在单个数据库中。创建三个逻辑卷,跨越您的SSD进行条带化:一个用于数据,一个用于 pg_wal,一个用于日志。

如果不是,您可能最好使用每个表一个数据库或一个数据库集群。

英文:

You can answer the question yourself.

  • Are the data used by the same application?

  • Are the data from these tables joined?

  • Should these tables always be started and stopped together and have the same PostgreSQL version?

If yes, then they had best be stored together in a single database. Create three logical volumes that is striped across your SSDs: one for the data, one for pg_wal, one for the logs.

If not, you might be best off with a database or a database cluster per table.

huangapple
  • 本文由 发表于 2023年2月8日 20:34:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/75385857.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定