5. Time-series Data? (2)
• Time-centric
• Data records always have a timestamp
• Append-only
• Data is almost solely append-only (INSERTs)
• Recent
• New data is typically about recent time intervals
6. Time-series Data? (3)
• Monitoring computer systems
• VM, server, container metrics (CPU, free memory, net/disk IOPS)
• Service and application metrics (request rates, request latency)
• Financial trading systems
• Classic securities, newer cryptocurrencies, payments, transaction events
• Internet of Things
• Data from sensors on industrial machines and equipment
• Eventing applications
• User/customer interaction data like clickstreams, pageviews, logins, singups
• Environmental monitoring
• Temperature, humidity, pressure, pH, pollen count, air flow, …
8. Easy to Use
• Full SQL interface for all SQL natively supported by PostgreSQL
• Secondary indexes
• Non time-based aggregates
• Sub-queries
• Window functions
• Connects to any client or tool that speaks PostgresSQL
• Time-oriented features
• Robust support for Data retention policies
9. Scalable
• Transparent time/space partitioning
• Scaling up (single node)
• Scaling out (private beta)
• High data write rates
• Right-sized chunks
• Parallelized operations across chunks and servers
10. Reliable
• Engineered up from PostgreSQL, packaged as an extension
• Proven foundations
• From 20+ years of PostgreSQL research
• Streaming replication
• Backups
• Flexible management options
• Compatible with existing PostgreSQL ecosystem and tooling
11. Architecture
• Hypertables
• Abstraction of a single continuous table across all space and time
intervals
• Chunks
• Each chunk corresponds to a specific time interval and a region of
partition key’s space
13. Installing
• https://docs.timescale.com/latest/getting-started/installation
• Using Docker Image
• shm-size: set /dev/shm partition size
• Mapping /var/lib/postgresql/data to host directory
$ docker run -d --name timescaledb -p 5432:5432
-e POSTGRES_PASSWORD=password
-v /mnt/timescaledb:/var/lib/postgresql/data
--shm-size 1G
timescale/timescaledb:1.5.1-pg11
14. Setting up
$ psql -U postgres -h localhost
postgres=# create database tutorial;
CREATE DATABASE
postgres=# c tutorial
You are now connected to database "tutorial" as user "postgres".
tutorial=# create extension if not exists timescaledb cascade;
NOTICE: extension "timescaledb" already exists, skipping
CREATE EXTENSION
15. Creating a Hypertable
tutorial=# CREATE TABLE conditions (
tutorial(# time TIMESTAMPTZ NOT NULL,
tutorial(# location TEXT NOT NULL,
tutorial(# temperature DOUBLE PRECISION NULL,
tutorial(# humidity DOUBLE PRECISION NULL
tutorial(# );
CREATE TABLE
tutorial=# SELECT create_hypertable('conditions', 'time’,
chunk_time_interval => interval '1 day');
create_hypertable
-------------------------
(1,public,conditions,t)
(1 row)