Swiftpack.co - Package - timescale/timescaledb

|Linux/macOS|Windows|Coverity| |:---:|:---:|:---:| |Build Status|Windows build status|Coverity Scan Build Status


TimescaleDB is an open-source database designed to make SQL scalable for time-series data. It is engineered up from PostgreSQL, providing automatic partitioning across time and space (partitioning key), as well as full SQL support.

TimescaleDB is packaged as a PostgreSQL extension and released under the Apache 2 open-source license. Contributors welcome.

Below is an introduction to TimescaleDB. For more information, please check out these other resources:

(Before building from source, see instructions below.)

Using TimescaleDB

TimescaleDB scales PostgreSQL for time-series data via automatic partitioning across time and space (partitioning key), yet retains the standard PostgreSQL interface.

In other words, TimescaleDB exposes what look like regular tables, but are actually only an abstraction (or a virtual view) of many individual tables comprising the actual data. This single-table view, which we call a hypertable, is comprised of many chunks, which are created by partitioning the hypertable's data in either one or two dimensions: by a time interval, and by an (optional) "partition key" such as device id, location, user id, etc. (Architecture discussion)

Virtually all user interactions with TimescaleDB are with hypertables. Creating tables and indexes, altering tables, inserting data, selecting data, etc., can (and should) all be executed on the hypertable.

From the perspective of both use and management, TimescaleDB just looks and feels like PostgreSQL, and can be managed and queried as such.

Creating a hypertable

-- We start by creating a regular SQL table
CREATE TABLE conditions (
  time        TIMESTAMPTZ       NOT NULL,
  location    TEXT              NOT NULL,

-- Then we convert it into a hypertable that is partitioned by time
SELECT create_hypertable('conditions', 'time');

Inserting and querying data

Inserting data into the hypertable is done via normal SQL commands:

INSERT INTO conditions(time, location, temperature, humidity)
  VALUES (NOW(), 'office', 70.0, 50.0);

SELECT * FROM conditions ORDER BY time DESC LIMIT 100;

SELECT time_bucket('15 minutes', time) AS fifteen_min,
    location, COUNT(*),
    MAX(temperature) AS max_temp,
    MAX(humidity) AS max_hum
  FROM conditions
  WHERE time > NOW() - interval '3 hours'
  GROUP BY fifteen_min, location
  ORDER BY fifteen_min DESC, max_temp DESC;

In addition, TimescaleDB includes additional functions for time-series analysis that are not present in vanilla PostgreSQL. (For example, the time_bucket function above.)


TimescaleDB can be installed via a variety of ways:

We recommend following our detailed installation instructions.

Building from source (Unix-based systems)

If you are building from source for non-development purposes (i.e., you want to run TimescaleDB, not submit a patch), you should always use a release-tagged commit and not build from master. See the Releases tab for the latest release.


  • A standard PostgreSQL 9.6 or 10 installation with development environment (header files) (e.g., postgresql-server-dev-9.6package for Linux, Postgres.app for MacOS)
  • C compiler (e.g., gcc or clang)
  • CMake version 3.4 or greater
git clone git@github.com:timescale/timescaledb.git
cd timescaledb

# Find the latest release and checkout, e.g. for 0.8.0:
git checkout 0.8.0

# Bootstrap the build system

# To build the extension
cd build && make

# To install
make install

Please see our additional configuration instructions.

Building from source (Windows)

If you are building from source for non-development purposes (i.e., you want to run TimescaleDB, not submit a patch), you should always use a release-tagged commit and not build from master. See the Releases tab for the latest release.


  • A standard PostgreSQL 9.6 or 10 64-bit installation
  • Microsoft Visual Studio 2017 with CMake and Git components
  • OR Visual Studio 2015/2016 with CMake version 3.4 or greater and Git
  • Make sure all relevant binaries are in your PATH: pg_config, cmake, MSBuild

If using Visual Studio 2017 with the CMake and Git components, you should be able to simply clone the repo and open the folder in Visual Studio which will take care of the rest.

If you are using an earlier version of Visual Studio, then it can be built in the following way:

git clone git@github.com:timescale/timescaledb.git
cd timescaledb

# Find the latest release and checkout, e.g. for 0.8.0:
git checkout 0.8.0

# Bootstrap the build system

# To build the extension from command line
cd build
MSBuild.exe timescaledb.sln

# To install
MSBuild.exe /p:Configuration=Release INSTALL.vcxproj

# Alternatively, open build/timescaledb.sln in Visual Studio and build

Additional documentation



Stars: 4316
Help us keep the lights on


Used By

Total: 0


0.9.0 - Mar 5, 2018

Please note: When updating your database, you should connect using psql with the -X flag to prevent any .psqlrc commands from accidentally triggering the load of a previous DB version.

High-level changes

  • Support for multiple extension versions on different databases in the same PostgreSQL instance. This allows different databases to be updated independently and provides for smoother updates between versions. No more spurious errors in the log as the extension is being updated, and new versions no longer require a restart of the database.
  • Streamlined update process for smaller binary/package sizes
  • Significant refactoring to simplify and improve codebase, including improvements to error handling, security/permissions, and more
  • Corrections to edge-case scenarios involving dropping schemas, hypertables, dimensions, and more
  • Correctness improvements through propagating reloptions from main table to chunk tables and blocking ONLY commands that try to alter hypertables (i.e., changes should be applied to chunks as well)
  • Addition of a migrate_data option to create_hypertable to allow non-empty tables to be turned into hypertables without separate creation & insertion steps. Note, this option may take a while if the original table has lots of data
  • Support for adjusting the number of partitions for a space dimension
  • Improvements to tablespace handling

Notable commits

  • [4672719] Fix error in handling of RESET ALL
  • [9399308] Refactor/simplify update scripts and build process
  • [0e79df4] Fix handling of custom SQL-based partitioning functions
  • [f13969e] Fix possible memory safety issue and squash valgrind error.
  • [ef74491] Migrate table data when creating a hypertable
  • [2696582] Move index and constraints drop handling to event trigger
  • [d6baccb] Improve tablespace handling, including blocks for DROP and REVOKE
  • [b9a6f89] Handle DROP SCHEMA for hypertable and chunk schemas
  • [b534a5a] Add test case for adding metadata entries automatically
  • [6adce4c] Handle TRUNCATE without upcall and handle ONLY modifier
  • [71b1124] Delete orphaned dimension slices
  • [fa19a54] Handle deletes on metadata objects via native catalog API
  • [6e011d1] Refactor hypertable-related API functions
  • [5afd39a] Fix locking for serializing chunk creation
  • [6dd2c46] Add check for null in ca_append_rescan to prevent segfault
  • [71962b8] Refactor dimension-related API functions
  • [cc254a9] Fix CREATE EXTENSION IF NOT EXISTS and error messages
  • [d135256] Spread chunk indexes across tablespaces like chunks
  • [e85721a] Block ONLY hypertable on all ALTER TABLE commands.
  • [78d36b5] Handle subtxn for cache pinning
  • [26ef77f] Add subtxn abort logic to process_utility.c
  • [25f3284] Handle cache invalidation during subtxn rollback
  • [264956f] Block DROP NOT NULL on time-partitioned columns.
  • [ad7d361] Better accounting for number of items stored in a subspace
  • [12f92ea] Improve speed of out-of-order inserts
  • [87f055d] Add support for ALTER TABLE RENAME CONSTRAINT.
  • [da8cc79] Add support for multiple extension version in one pg instance
  • [68faddc] Make chunks inherit reloptions set on the hypertable
  • [4df8f28] Add proper permissions handling for associated (chunk) schemas
  • [21efcce] Refactor chunk table creation and unify constraint handling


  • @Anthares for a request to pass reloptions like fill factor to child chunks
  • @oldgreen for reporting an issue with subtransaction handling
  • @fvannee for a PR that fixed a bug with ca_append_rescan
  • @maksm90 for reporting an superfluous index being created in an internal catalog table
  • @Rashid987 for reporting an issue where deleting a chunk, then changing the time interval would not apply the change when a replacement chunk is created
  • RaedA from Slack for reporting compilation issues on Windows between 0.8.0 and this release
  • @haohello for a request to adjust the number of partitions for a given dimension
  • @LonghronShen and @devereaux for reporting an issue (and submitting a PR) for handling version identification when there is more to the version than just major and minor numbers
  • @carlospeon for reporting an issue with dropping hypertables
  • @gumshoes, @simpod, @jbylund, and @ryan-shaw for testing a pre-release version to verify our new update path works as expected
  • @gumshoes for reporting an issue with RESET ALL

0.8.0 - Dec 20, 2017

High-level changes

  • TimescaleDB now builds and runs on Windows! Now in addition to using Docker, users can choose to build the extension from source and install on 64-bit Windows
  • Update functions add_dimension and set_chunk_time_interval to take INTERVAL types
  • Improved tablespace management including detaching tablespaces from hypertables and looking up tablespaces associated with a hypertable
  • Reduced memory usage for INSERTs with out-of-order data
  • Fix inserts on 32-bit architectures, in particular ARM
  • Other correctness improvements including preventing attachment of PG10 partitions to hypertables, improved handling of space dimensions with one partition, and correctly working with pg_upgrade
  • Test and build improvements making those both more robust and easier to do

Notable commits

  • [26971d2] Make tablespace_show function return Name instead of CString
  • [2fe447b] Make TimescaleDB work with pg_upgrade
  • [90c7a6f] Fix logic for one space partition
  • [6cfdd79] Prevent native partitioning attachment of hypertables
  • [438d79d] Fix trigger relcache handling for COPY
  • [cc1ad95] Reduce memory usage for out-of-order inserts
  • [a0f62c5] Improve bootstrap script's robustness
  • [00a096f] Modify tests to make more platform agnostic
  • [0e76b5f] Do not add tablespaces to hypertable objects
  • [176b75e] Add command to show tablespaces attached to a hypertable
  • [6e92383] Add function to detach tablespaces from hypertables
  • [e593876] Refactor tablespace handling
  • [c4a46ac] Add hypertable cache lookup on ID/pkey
  • [f38a578] Fix handling of long constraint names
  • [20c9b28] Unconditionally add pg_config --includedir to src build
  • [12dff61] Fixes insert for 32bit architecture
  • [e44e47e] Update add_dimension to take INTERVAL times
  • [0763e62] Update set_chunk_time_interval to take INTERVAL times
  • [87c4b4f] Fix test generator to work for PG 10.1
  • [51854ac] Fix error message to reflect that drop_chunks can take a DATE interval
  • [66396fb] Add build support for Windows
  • [e1a0e81] Refactor and fix cache invalidation


  • @oldgreen for reporting an issue where COPY was warning of relcache reference leaks
  • @campeterson for pointing out some documentation typos
  • @jwdeitch for the PR to prevent attaching PG10 partitions to hypertables
  • @vjpr and @sztanpet for reporting bugs and suggesting improvements to the bootstrap script

0.7.1 - Nov 29, 2017

High-level changes

  • Fix to the migration script for those coming from 0.6.1 (or earlier)
  • Fix edge case in drop_chunks when hypertable uses TIMESTAMP type
  • Query planning improvements & fixes
  • Permission fixes and support SET ROLE functionality

Notable commits

  • [717299f] Change time handling in drop_chunks for TIMESTAMP times
  • [d8ec285] Do not append-optimize plans with result relations (DELETE/UPDATE)
  • [30b72ec] Handle empty append plans in ConstraintAwareAppend
  • [b35509b] Permission fixes and allow SET ROLE


  • @shaneodonnell for reporting a bug with empty append plans in ConstraintAwareAppend
  • @ryan-shaw for reporting a bug with query plans involving result relations and reporting an issue with our 0.6.1 to 0.7.0 migration script

0.7.0 - Nov 21, 2017

Please note: This update may take a long time (minutes, even hours) to complete, depending on the size of your database

High-level changes

  • Initial PostgreSQL 10 support. TimescaleDB now should work on both PostgreSQL 9.6 and 10. As this is our first release supporting PG10, we look forward to community feedback and testing. Some release channels, like Ubuntu & RPM-based distros will remain on 9.6 for now
  • Support for CLUSTER on hypertables to recursively apply to chunks
  • Improve constraint handling of edge cases for DATE and TIMESTAMP
  • Fix range_start and range_end to properly handle the full 32-bit int space
  • Allow users to specify their desired partitioning function
  • Enforce NOT NULL constraint on time columns
  • Add testing infrastructure to use Coverity and test PostgreSQL regression tests in TimescaleDB
  • Switch to the CMake build system for better cross-platform support
  • Several other bug fixes, cleanups, and improvements

Notable commits

  • [13e1cb5] Add reindex function
  • [6594018] Handle when create_hypertable is invoked on partitioned table
  • [818bdbc] Add coverity testing
  • [5d0cbc1] Recurse CLUSTER command to chunks
  • [9c7191e] Change TIMESTAMP partitioning to be completely tz-independent
  • [741b256] Mark IMMUTABLE functions as PARALLEL SAFE
  • [2ffb30d] Make aggregate serialize and deserialize functions STRICT
  • [c552410] Add build target to run the standard PostgreSQL regression tests
  • [291050b] Change DATE partitioning to be completely tz-independent
  • [ca0968a] Make all partitioning functions take anyelement argument
  • [a4e1e32] Change range_start and range_end semantics
  • [2dfbc82] Fix off-by-one error on range-end
  • [500563f] Add support for PostgreSQL 10
  • [201a948] Check that time dimensions are set as NOT NULL.
  • [4532650] Allow setting partitioning function
  • [4a0a0d8] Fix column type change on plain tables
  • [cf009cc] Avoid string conversion in hash partitioning
  • [8151098] Improve update testing by adding a rerun test
  • [c420c11] Create a catalog entry for constraint-backed indexes
  • [ec746d1] Add ability to run regression test locally
  • [44f9fec] Add analyze to parallel test for stability
  • [9e0422a] Fix bug with pointer assignment after realloc
  • [114fa8d] Refactor functions used to recurse DDL commands to chunks
  • [b1ec4fa] Refactor build system to use CMake


  • @jgraichen for reporting an issue with drop_chunks not accepting BIGINT
  • @nathansgreen for reporting an edge case with constraints for TIMESTAMP
  • @jonmd for reporting a similar edge case for DATE
  • @jwdeitch for a PR to cover an error case in PG10

0.6.1 - Nov 7, 2017

High-level changes

  • Fix several memory bugs that caused segfaults
  • Fix bug when creating expression indexes
  • Plug a memory leak with constraint expressions
  • Several other bug fixes and stability improvements

Notable commits

  • [2799075] Fix EXPLAIN for ConstraintAware and MergeAppend
  • [8084594] Use per-chunk memory context for cached chunks
  • [a13d9de] Do not convert tuples on insert unless needed
  • [da09f24] Limit growth of range table during chunk inserts
  • [85dee79] Fix issue with creating expression indexes
  • [844ff7f] Fix memory leak due to constraint expressions.
  • [e90d3ee] Consider precvious CIS state in copy FROM file to rel
  • [56d632f] Fix bug with pointer assignment after realloc
  • [f97d624] Make event trigger creation idempotent


  • @jwdeitch for submitting a patch to correct behavior in the COPY operation
  • @jgraichen for reporting a bug with expression indexes
  • @zixet for reporting a memory leak
  • @djk447 for reporting a bug in EXPLAIN with ConstraintAware and MergeAppend