postgresql,

How to install, enable and list TimescaleDB version in PostgreSQL

Feb 17, 2022 · 1 min read · Post a comment

TimescaleDB is a PostgreSQL extension that enables easier approach when working with time-series data. Today we are going to see how can we install, enable/disable, get the TimescaleDB version of the databases, and optionally remove it.

Prerequisites

  • PostgreSQL

Install TimescaleDB

Regarding the installation, there are few ways you could do it depending on your needs, and the instructions in the official documentation are pretty good and clear.

Install TimescaleDB.

Enable TimescaleDB and list versions

Step 1. Login to PostgreSQL.

psql -h some_host -d some_db -U some_username

Step 2. Enable the extension.

CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;

Note(s): You could specify version though, by adding VERSION, for instance:

CREATE EXTENSION IF NOT EXISTS timescaledb VERSION "1.4.2" CASCADE;

Step 3. List installed extension versions.

SELECT default_version, installed_version
FROM   pg_available_extensions
WHERE  name = 'timescaledb';

Output:

 default_version | installed_version 
-----------------+-------------------
 1.4.2           | 1.4.2
(1 row)

Note(s):

  • default_version: Server instance/Docker container image version installed.
  • installed_version: Enabled and currently running PostgreSQL version.
  • Sometimes these versions could be different, and you may need to upgrade/downgrade.

Remove TimescaleDB extension

DROP EXTENSION IF EXISTS timescaledb;

Conclusion

As always, if you stuck anywhere using the steps above, let me know in the comment section below, no sign up required. On a side note, follow our official channel on Telegram.