Skip to content

Commit

Permalink
fix: update queries to work in sequence.
Browse files Browse the repository at this point in the history
  • Loading branch information
billy-the-fish committed Dec 19, 2024
1 parent 9a85dd9 commit 5ab0797
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ CREATE TABLE conditions (
SELECT create_hypertable('conditions', by_range('time'));
```

In the docker image, timescale db is already active in the postgres database instance. IAIN CREATE EXTENSION timescaledb;

See more:

- [About hypertables](https://docs.timescale.com/use-timescale/latest/hypertables/)
Expand All @@ -68,7 +70,7 @@ TimescaleDB's hypercore is a hybrid row-columnar store that boosts analytical qu
```sql
ALTER TABLE conditions SET (
timescaledb.compress,
timescaledb.compress_segmentby = 'device_id'
timescaledb.compress_segmentby = 'time'
);
```
Expand Down Expand Up @@ -151,15 +153,15 @@ For example, create a continuous aggregate view for daily weather data in two si
CREATE MATERIALIZED VIEW conditions_summary_daily
WITH (timescaledb.continuous) AS
SELECT
device,
location,
time_bucket(INTERVAL '1 day', time) AS bucket,
AVG(temperature),
MAX(temperature),
MIN(temperature)
FROM
conditions
GROUP BY
device,
location,
bucket;
```
Expand Down

0 comments on commit 5ab0797

Please sign in to comment.