Questions tagged [timescaledb]

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension. QUESTIONS MUST BE ABOUT PROGRAMMING in order to be on-topic on Stack Overflow. Specifically, database administration is not on-topic for Stack Overflow.

TimescaleDB

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). It speaks full SQL and is correspondingly easy to use like a traditional relational database, yet scales in ways previously reserved for NoSQL databases.

Compared to the trade-offs demanded by these two alternatives (relational vs. NoSQL), TimescaleDB offers the best of both worlds for time-series data:

Features

Easy to Use

  • Full SQL interface for all SQL natively supported by PostgreSQL (including secondary indexes, non-time based aggregates, sub-queries, JOINs, window functions).
  • Connects to any client or tool that speaks PostgreSQL, no changes needed.
  • Time-oriented features, API functions, and optimizations.
  • Robust support for Data retention policies.

Scalable

  • Transparent time/space partitioning for both scaling up (single node) and scaling out (forthcoming).
  • High data write rates (including batched commits, in-memory indexes, transactional support, support for data backfill).
  • Right-sized chunks (two-dimensional data partitions) on single nodes to ensure fast ingest even at large data sizes.
  • Parallelized operations across chunks and servers.

Reliable

  • Engineered up from PostgreSQL, packaged as an extension.
  • Proven foundations benefiting from 20+ years of PostgreSQL research (including streaming replication, backups).
  • Flexible management options (compatible with existing PostgreSQL ecosystem and tooling).

Resources

691 questions
5
votes
1 answer

TimescaleDB query to select rows where column value changed from previous row

Just recently started using TimescaleDB with Postgres to handle most requests for data. However I'm running into an issue where I have a horribly inefficient request for time series of data. It's a data series that can be any length of time, with…
MLyck
  • 4,959
  • 13
  • 43
  • 74
5
votes
2 answers

How to convert a simple postgresql table to hypertable or timescale db table using created_at for indexing

The problem is that when I want to convert a simple Postgresql table to timescaledb table or hypertable using created_at table field for indexing then it will show this error. The table name is orders. Here cas_admin_db_new is the databse name. I…
Suman Das
  • 301
  • 1
  • 4
  • 18
5
votes
1 answer

Does timescaledb index works the same as postgreSQL?

I am testing an PostgreSQL extension named Timescaledb for time series data. If I read the document of PostgreSQL right, the query for example WHERE x = 'somestring' and timestamp between 't1' and 't2' will work best with index (x,timestamp). And…
Maxi Wu
  • 1,274
  • 3
  • 20
  • 38
5
votes
1 answer

Postgres error after updating TimescaleDB on Ubuntu: file not found

As specified in the official docs I added the Timescale PPA repository to apt. I then installed it via sudo apt install timescaledb-postgresql-9.6. All was working fine. With a recent run of sudo apt upgrade the timescale package got updated from…
5
votes
1 answer

Optimize timescale query

I am using the below query with timescaledb to get the 10 minute candles from a ticks database. SELECT time_bucket('10minute', time) AS min, first(ticks, time) AS open, last(ticks, time) AS close, max(ticks) AS high, min(ticks) AS low, …
5
votes
2 answers

Timescaledb time_bucket fetch periods with no row

I have sensors emitting data every ~20 seconds. However sometimes these are in trouble and doesn't emit data for minutes or hours. I would like to fetch those disconnection and know how long these last. So I tried with the function time_bucket to…
Raphiki
  • 190
  • 3
  • 11
4
votes
1 answer

Timescale interpolated_average with an additional group

Is there a way we add an extra group by to the toolkit_experimental.interpolated_average function? Say my data has power measurements for different sensors; how would I add a group by on the sensor_id? with s as ( select sensor_id, …
4
votes
2 answers

Sometimes one record from the set does not get into the database using EF Core and TimescaleDB

I faced pretty strange behavior in my tests, when only one record from the set is not added to the database and this happens from time to time, not always. Heres logs: Postgres: 2022-04-29 16:25:28.685 UTC [1914] LOG: statement: DISCARD…
4
votes
1 answer

How can I efficiently query "change of value per day" with TimescaleDB?

Question I have the following table with PostgreSQL+TimescaleDB: create table heatingElectricityMeter( time timestamptz(0) not null, import real not null ); select create_hypertable('heatingElectricityMeter', 'time', chunk_time_interval =>…
yankee
  • 38,872
  • 15
  • 103
  • 162
4
votes
0 answers

Most efficient way to receive data from 10,000 websocket connections in Python and save it to a database

I am looking to implement a web server that will receive streaming data for all US Equities (approximately 10,000). I was wondering if there are any particular infrastructures that are best suited for this. I was planning to use a Gunicorn server…
4
votes
1 answer

Converting PostgreSQL table to TimescaleDB hypertable

I have a PostgreSQL table which I am trying to convert to a TimescaleDB hypertable. The table looks as follows: CREATE TABLE public.data ( event_time timestamp with time zone NOT NULL, pair_id integer NOT NULL, entry_id bigint NOT…
sev
  • 1,500
  • 17
  • 45
4
votes
1 answer

Does timescaledb support window functions?

I am trying to use the TimescaleDB extension to compute some continuous aggregates. I have this query which works fine: SELECT distinct time_bucket('1 hour', entry_ts) as date_hour, type_id, entry_id, …
4
votes
2 answers

how can i create materialized view with psycopg2?

I'm getting an error on creating continuous aggregates with timescaledb which uses postgres materialized views: connection = psycopg2.connect(DATABASE_URI) cursor = connection.cursor() cursor.execute( """CREATE MATERIALIZED VIEW quotes_1h WITH …
Hossein
  • 41
  • 5
4
votes
1 answer

PostgreSQL with TimescaleDB only uses a single core during index creation

we have a PostgreSQL hypertable with a few billion rows and we're trying to create a unique index on top of it like so: CREATE UNIQUE INDEX device_data__device_id__value_type__timestamp__idx ON public.device_data(device_id, value_type, "timestamp"…
hbrgnr
  • 410
  • 3
  • 13
4
votes
1 answer

pg_dump with --exclude-table still includes those tables in the background COPY commands it runs?

I am trying to take a backup of a TimescaleDB database, excluding two very big hypertables. That means that while the backup is running, I would not expect to see any COPY command of the underlying chunks, but I actually do! Let's say TestDB is my…
Rigerta
  • 3,959
  • 15
  • 26
1 2
3
45 46