PostgreSQL是否支持表(片段)的透明压缩? [英] Does PostgreSQL support transparent compressing of tables (fragments)?

查看:653
本文介绍了PostgreSQL是否支持表(片段)的透明压缩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在分散的PostgreSQL表(每天表)中存储大量数据(日志)。我想压缩其中的一些以节省光盘空间,但是我不想失去以通常的方式查询它们的能力。

I'm going to store large amount of data (logs) in fragmented PostgreSQL tables (table per day). I would like to compress some of them to save some space on my discs, but I don't want to lose the ability to query them in the usual manner.

可以PostgreSQL支持这种透明的压缩,在哪里可以更详细地了解它?我认为这种功能应该有一些众所周知的魔术名称。

Does PostgreSQL support such a transparent compression and where can I read about it in more detail? I think there should be some well-known magic name for such a feature.

推荐答案

是的,PostgreSQL会自动为您完成此操作当它们超过一定大小时。但是,压缩将应用于每个单独的数据值-而非整个表级别。这意味着,如果您有十亿行非常狭窄的行,它们将不会被压缩。或者,如果您有很多列,每个列中只有一个很小的值,它们将不会被压缩。 手册中。

Yes, PostgreSQL will do this automatically for you when they go above a certain size. Compression is applied at each individual data value though - not at the full table level. Meaning that if you have a billion rows that are very narrow, they won't get compressed. Or if you have very many columns each with only a small value in it, they won't get compressed. Details about this scheme in the manual.

如果在全表级别需要它,一种解决方案是为要压缩的那些表创建一个TABLESPACE,并将其指向压缩的文件系统。只要文件系统仍然遵循fsync()和标准POSIX语义,这应该是绝对安全的。 手册中的详细信息。

If you need it on the full table level, a solution is to create a TABLESPACE for those tables that you want compressed, and point it to a compressed filesystem. As long as the filesystem still obeys fsync() and standard POSIX semantics, this should be perfectly safe. Details about this in the manual.

这篇关于PostgreSQL是否支持表(片段)的透明压缩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆