Is the standard postgresql way also possible on a timescaledb hypertable?
CLUSTER [VERBOSE] tablename [ USING indexname ]
Example:
- Creating table & hypertyble
CREATE TABLE IF NOT EXISTS l1(
timestamp TIMESTAMP(6) NOT NULL,
data VARCHAR(8) NOT NULL,
SELECT create_hypertable('l1', 'timestamp', chunk_time_interval => interval '1 day');
- Produces an index like this (can be viewed using this command):
l1 | l1_timestamp_idx | CREATE INDEX l1_timestamp_idx ON public.l1 USING btree ("timestamp" DESC)
- And than
CLUSTERthe data like this
CLUSTER l1 USING l1_timestamp_idx;
stdout: CLUSTER
It looks like it works.. But is this recommended? And is it possible to reverse the order of the CLUSTER command? Meaning, sorting it with the lowest timestamp first.