在 PostgreSQL TimescaleDB(时间序列)数据库上有一个普通的 table

Have an ordinary table on a PostgreSQL TimescaleDB (timeseries) database

对于一个项目,我需要两种类型的 tables。

  1. hypertable(这是 PostgreSQL 中的一种特殊类型 table(在 PostgreSQL TimescaleDB 中))用于某些时间序列记录
  2. 我的普通 table 不是时间序列

我可以创建一个 PostgreSQL TimescaleDB 并在上面存储我的普通 tables 吗? PostgreSQL TimescaleDB 上的所有 table 都是 hypertable(时间序列)吗?如果不是,如果我将我的普通 tables 存储在 PostgreSQL TimescaleDB 中是否会有一些开销?

如果可以的话,如果我将我的普通 table 存储在一个单独的普通 PostgreSQL 数据库中有什么好处吗?

Can I create a PostgreSQL TimescaleDB and store my ordinary tables on it?

绝对... TimescaleDB 作为 PostgreSQL 的扩展提供,最大的好处之一是您可以在专业时间的同时使用常规 PostgreSQL tables -系列 tables。这包括在具有 hypertables 的 SQL 查询中使用常规 tables。标准 SQL 有效,此外还有一些 Timescale 使用 PostgreSQL 的可扩展性功能创建的附加函数。

Are all the tables a hypertable (time series) on a PostgreSQL TimescaleDB?

不,您必须显式创建一个 table 作为 hypertable 才能实现 TimescaleDB 功能。值得查看时间刻度文档中的操作指南以获取完整(和最新)的详细信息。

If no, does it have some overhead if I store my ordinary tables in PostgreSQL TimescaleDB?

我认为没有存储开销。您可能会看到一些性能提升,例如用于数据摄取和查询性能。这篇文章可能有助于阐明 https://docs.timescale.com/timescaledb/latest/overview/how-does-it-compare/timescaledb-vs-postgres/

总体而言,您可以将 TimescaleDB 视为向 'vanilla' PostgreSQL 提供附加功能,因此除非应用程序设计有理由将非时间序列数据分离到单独的数据库中,否则您没有义务这样做。

另一点,由我们 Slack 社区的一位非常有经验的成员分享 [谢谢 Chris]:

To have time-series data and “normal” data (normalized) in one or separate databases for us came down to something like “can we asynchronously replicate the time-series information”? In our case we use two different pg systems, one replicating asynchronously (for TimescaleDB) and one with synchronous replication (for all other data).

透明度:我为 Timescale 工作