TimescaleDB
TimescaleDB is a category-defining relational database for time-series data. Packaged as a PostgreSQL extension, TimescaleDB is designed to be easy to use, easy to get started, and easy to maintain.
Download this sample dataset by Timescale
Docker Compose
mkdir /tmp/prest+timescaledb
cd /tmp/prest+timescaledb
cat <<YML > docker-compose.yml
---
version: "3"
services:
timescaledb:
image: timescale/timescaledb:latest-pg12
volumes:
- "./data:/var/lib/postgresql/data"
- "/tmp:/var/tmp"
environment:
- POSTGRES_USER=prest
- POSTGRES_DB=prest
- POSTGRES_PASSWORD=prest
ports:
- "5432:5432"
prest:
image: prest/prest:latest
links:
- "timescaledb:timescaledb"
environment:
- PREST_DEBUG=true # remove comment for enable DEBUG mode (disable JWT)
- PREST_PG_HOST=timescaledb
- PREST_PG_USER=prest
- PREST_PG_PASS=prest
- PREST_PG_DATABASE=prest
- PREST_PG_PORT=5432
- PREST_JWT_DEFAULT=false # remove if need jwt
- PREST_SSL_MODE=disable
depends_on:
- timescaledb
ports:
- "3000:3000"
YMLStarting up the containers
Creating database structure
Loading data
Simple Query
SQL execution:
prestd execution:
Joining tables
SQL execution:
prestd execution:
Using VIEWs
Creating VIEW named battery_level_by_hour:
Aggregating data over battery_level_by_hour view:
prestd execution:
Simple SELECT over battery_level_by_hour view:
**prestd execution over battery_level_by_hour view:
Batch Insert data
Using default INSERT statement WITH returning inserted data:
Using COPY statement WITHOUT returning inserted data:
Was this helpful?