postgresql,

How to Install, Enable and List TimescaleDB version in PostgreSQL

Feb 17, 2022 · 1 min read · Post a comment
How to Install, Enable and List TimescaleDB version in PostgreSQL

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 database, 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: 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';

Example output:

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

Note(s):

  • default_version is the server instance / Docker container image version installed.
  • installed_version is the version enabled and used by PostgreSQL.
  • 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.