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 configureconfigure TimescaleDB properly.

First connect to the PostgreSQL instance:

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

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

  1. -- Create the database, let's call it 'tutorial'
  2. CREATE database tutorial;

warning

Starting in v0.12.0, TimescaleDB enables telemetry reportingtelemetry-reporting. by default. You can opt-out by following the instructions detailed in our telemetry documentationtelemetry-documentation. However, please do note that telemetry is anonymous, and by keeping it on, you help us improve our productimprove-our-product.

Lastly add TimescaleDB:

  1. -- Connect to the database
  2. \c tutorial
  3. -- Extend the database with TimescaleDB
  4. 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:

  1. 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.