英文:
PostgreSQL database design on multiple disks
问题
我有一台物理机,上面有几块SSD硬盘和全新安装的PostgreSQL:我将在几个不同的表中加载大约1-2TB的数据(它们之间没有互联),每个表包含不同的数据实体。
我在考虑两种方法:
- 为每个实体的数据创建一个数据库(具有相应的数据实体表)。
- 创建一个数据库,但将每个数据实体的表存储在不同的硬盘上。
因此,我的问题如下:哪种方法更受推荐,哪种方法成本较低?
英文:
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:
- Create DB (with corresponding table for data entity) on each disk for each entity.
- 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论