【发布时间】:2021-06-14 21:23:26
【问题描述】:
我正在测试一些关于 Postgresql 扩展 Timescaledb 的查询。 该表称为 timestampdb,我在上面运行了一些查询,看起来像这样
select id13 from timestampdb where timestamp1 >='2010-01-01 00:05:00' and timestamp1<='2011-01-01 00:05:00',
select avg(id13)::numeric(10,2) from timestasmpdb where timestamp1>='2015-01-01 00:05:00' and timestamp1<='2015-01-01 10:30:00'
当我创建一个超表时,我会这样做。
create hyper_table('timestampdb','timestamp1')
问题是现在我想在 id13 上创建一个索引。
我应该尝试这样的事情吗?:
create hyper_table('timestampdb','timestamp1') ,import data of the table and then create index on timestampdb(id13)
或类似的东西:
create table timestampdb,then create hypertable('timestampdb',timestamp1') ,import the data and then CREATE INDEX ON timestampdb (timestamp1,id13)
这样做的正确方法是什么?
【问题讨论】:
标签: postgresql performance indexing timescaledb