Setup

Ok, you have installed TimescaleDB, and now you are ready to work with some data. The first thing to do is to create a new empty database or convert an existing PostgreSQL database to use TimescaleDB.

tip
If you are planning on doing any performance testing on TimescaleDB, we strongly recommend that you configure TimescaleDB properly.

First connect to the PostgreSQL instance:

# Connect to PostgreSQL, using a superuser named 'postgres'
psql -U postgres -h localhost

Now create a new empty database (skip this if you already have a database):

-- Create the database, let's call it 'tutorial'
CREATE database tutorial;
warning
Starting in v0.12.0, TimescaleDB enables telemetry reporting by default. You can opt-out by following the instructions detailed in our telemetry documentation. However, please do note that telemetry is anonymous, and by keeping it on, you help us improve our product.

Lastly add TimescaleDB:

-- Connect to the database
\c tutorial

-- Extend the database with TimescaleDB
CREATE EXTENSION IF NOT EXISTS timescaledb;
tip
If you want to install a version that is not the most recent available on your system you can specify the version like so: CREATE EXTENSION timescaledb VERSION '2.1.0';

That's it! Connecting to the new database is as simple as:

psql -U postgres -h localhost -d tutorial

Now that you have a new TimescaleDB database setup, start by inserting or creating data to learn more about the features and superpowers we add to time-series data:

  1. Start from scratch: You don't currently have any data, and just want to create an empty hypertable for inserting data.
  2. Migrate from PostgreSQL: You are currently storing time-series data in a PostgreSQL database, and want to move this data to a TimescaleDB hypertable.

Found an issue on this page?

Report an issue!