TimescaleDB is a PostgreSQL extension for time series and demanding workloads that ingest and query high volumes of data.

Want to skip these steps?

Deploy a Timescale service in the cloud. We tune your database for performance and handle scalability, high availability, backups and management so you can relax.

Try for free

This section shows you how to:

Warning

If you have previously installed PostgreSQL without a package manager, you may encounter errors following these install instructions. Best practice is to full remove any existing PostgreSQL installations before you begin.

To keep your current PostgreSQL installation, Install from source.

Best practice for self-hosting TimescaleDB is to install the latest version of PostgreSQL and TimescaleDB on a supported platform using the packages supplied by Timescale.

  1. Install the latest PostgreSQL packages

    sudo apt install gnupg postgresql-common apt-transport-https lsb-release wget
  2. Run the PostgreSQL package setup script

    sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
  3. Add the TimescaleDB package

    echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/timescaledb.list
  4. Install the TimescaleDB GPG key

    wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpg

    For Ubuntu 21.10 and earlier use the following command:

    wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add -

  5. Update your local repository list

    sudo apt update
  6. Install TimescaleDB

    sudo apt install timescaledb-2-postgresql-16 postgresql-client

    To install a specific TimescaleDB release, set the version. For example:

    sudo apt-get install timescaledb-2-postgresql-14='2.6.0*' timescaledb-2-loader-postgresql-14='2.6.0*'

    Older versions of TimescaleDB may not support all the OS versions listed on this page.

  7. Tune your PostgreSQL instance for TimescaleDB

    sudo timescaledb-tune

    This script is included with the timescaledb-tools package when you install TimescaleDB. For more information, see configuration.

  8. Restart PostgreSQL

    sudo systemctl restart postgresql
  9. Login to PostgreSQL as postgres

    sudo -u postgres psql

    You are in the psql shell.

  10. Set the password for postgres

    \password postgres

    When you have set the password, type \q to exit psql.

Job jobbed, you have installed PostgreSQL and TimescaleDB.

For improved performance, you enable TimescaleDB on each database on your self-hosted PostgreSQL instance. This section shows you how to enable TimescaleDB for a new database in PostgreSQL using psql from the command line.

  1. Connect to your PostgreSQL instance

    psql -U postgres -h localhost
  2. Create a database

    CREATE DATABASE tsdb;
  3. Connect to the database

    \c tsdb
  4. Add TimescaleDB to the database

    CREATE EXTENSION IF NOT EXISTS timescaledb;
  5. Check that TimescaleDB is installed

    \dx

    You see the list of installed extensions:

    List of installed extensions
    Name | Version | Schema | Description
    -------------+---------+------------+---------------------------------------------------------------------------------------
    plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
    timescaledb | 2.14.2 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)

    Press q to exit the list of extensions.

And that is, you have TimescaleDB running on a database on a self-hosted instance of PostgreSQL.

Now you have TimescaleDB running, have a look at the:

  • Tutorials: walk through a variety of business scenarios using example datasets.
  • Use Timescale: browse the features available with TimescaleDB.

TimescaleDB is supported on the following platforms:

DebianUbuntuRed Hat EnterpriseFedoraRocky Linux
Debian 10 BusterUbuntu 20.04 LTS Focal FossaRed Hat Enterprise Linux 7Fedora 33Rocky Linux 8
Debian 11 BullseyeUbuntu 22.04 LTS Jammy JellyfishRed Hat Enterprise Linux 8Fedora 34Rocky Linux 9
Debian 12 BookwormUbuntu 23.04 Lunar LobsterRed Hat Enterprise Linux 9Fedora 35

Keywords

Found an issue on this page?

Report an issue!