<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Loki_vs_postgres_hypertable</id>
	<title>Loki vs postgres hypertable - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Loki_vs_postgres_hypertable"/>
	<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Loki_vs_postgres_hypertable&amp;action=history"/>
	<updated>2026-05-10T18:37:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://tech.uvoo.io/index.php?title=Loki_vs_postgres_hypertable&amp;diff=5572&amp;oldid=prev</id>
		<title>Busk: Created page with &quot;Here’s a rough comparison of what you might see when querying a **1-month, \~100 GB** time-series dataset on commodity hardware (e.g. SSDs, 16 cores). Actual numbers will va...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Loki_vs_postgres_hypertable&amp;diff=5572&amp;oldid=prev"/>
		<updated>2025-07-07T16:47:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Here’s a rough comparison of what you might see when querying a **1-month, \~100 GB** time-series dataset on commodity hardware (e.g. SSDs, 16 cores). Actual numbers will va...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Here’s a rough comparison of what you might see when querying a **1-month, \~100 GB** time-series dataset on commodity hardware (e.g. SSDs, 16 cores). Actual numbers will vary based on data cardinality, step size, compression, and parallelism.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
**PostgreSQL Hypertable (TimescaleDB)**&lt;br /&gt;
&lt;br /&gt;
* **Performance:**  TimescaleDB benchmarks report up to **350×–1 000× faster** queries than vanilla PostgreSQL, thanks to time-partitioned “chunks,” adaptive chunk-skipping, and (optionally) continuous aggregates. ([timescale.com][1], [tigerdata.com][2])&lt;br /&gt;
* **Latency:**  A full 1-month range-aggregate over \~100 GB raw (\~10 GB compressed) typically completes in **1–3 s**. Pre-aggregated (continuous) views can serve sub-100 ms results.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
**Prometheus TSDB**&lt;br /&gt;
&lt;br /&gt;
* **Architecture:**  Data is stored in 2 h blocks with an index of series IDs → chunks, and queries are executed via PromQL over these blocks.&lt;br /&gt;
* **Latency:**  A 1-month range query at 1 min resolution (\~43 200 points) spans \~360 blocks. On a single Prometheus instance, you’re likely to see **5–30 s** per query, depending on series cardinality and step. In a highly parallel Grafana Mimir (Prometheus long-term) setup (1 b active series), **99.9 %** of reads complete in **&amp;lt; 2 s**. ([grafana.com][3])&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
**Grafana Loki (TSDB index)**&lt;br /&gt;
&lt;br /&gt;
* **Indexing model:**  Only metadata (labels) are indexed; raw log chunks are kept in object storage. Queries are *sharded* at the TSDB level.&lt;br /&gt;
* **Throughput:**  Loki TSDB aims for **300–600 MB/s** per query shard. ([grafana.com][4])&lt;br /&gt;
* **Latency (200 GB bench → \~100 GB scale):**&lt;br /&gt;
&lt;br /&gt;
  * **Label-only filter** (e.g. `{region=&amp;quot;us-east-2&amp;quot;}`): \~\~1 s&lt;br /&gt;
  * **Full-text/regex filter** (e.g. `|=&amp;quot;queen&amp;quot;`): \~\~4 s&lt;br /&gt;
  * **Full-scan aggregation** (e.g. count by log level): \~\~40 s&lt;br /&gt;
    *(Quickwit vs. Loki benchmark: 212 GB logs → 90 s for full-scan; scaling to 100 GB ≈ 40 s)* ([quickwit.io][5])&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
| Technology          | Query Type                             | Approx. Latency (100 GB) |&lt;br /&gt;
| ------------------- | -------------------------------------- | ------------------------ |&lt;br /&gt;
| **TimescaleDB**     | Range-aggregate (continuous)           | **&amp;lt; 0.1 s**              |&lt;br /&gt;
|                     | Range-aggregate (raw scan)             | **1–3 s**                |&lt;br /&gt;
| **Prometheus TSDB** | 1 min-step range query                 | **5–30 s**               |&lt;br /&gt;
| **Grafana Loki**    | Label filter                           | \~1 s                    |&lt;br /&gt;
|                     | Full-text/regex filter                 | \~4 s                    |&lt;br /&gt;
|                     | Full-scan aggregation (count by level) | \~40 s                   |&lt;br /&gt;
&lt;br /&gt;
&amp;gt; **Caveats &amp;amp; tuning:**&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&amp;gt; * **TimescaleDB**: chunk interval, continuous aggregates, and compression settings can push latencies into the sub-second or millisecond range.&lt;br /&gt;
&amp;gt; * **Prometheus**: increasing `--query.max-concurrency` or using remote-read backends (e.g. Mimir) and proper step sizes will improve throughput.&lt;br /&gt;
&amp;gt; * **Loki**: tuning `tsdb_max_query_parallelism`, `chunk_encoding: snappy`, and using SSD-backed object storage can drastically cut query times.&lt;br /&gt;
&lt;br /&gt;
This should give you a ballpark—PostgreSQL hypertables (with TimescaleDB) excel at fast aggregations, Prometheus TSDB is optimized for metrics with moderate latency, and Loki’s log-centric model trades off higher latencies for low-index-overhead at ingest time.&lt;br /&gt;
&lt;br /&gt;
[1]: https://www.timescale.com/blog/timescale-cloud-vs-amazon-rds-postgresql-up-to-350-times-faster-queries-44-faster-ingest-95-storage-savings-for-time-series-data &amp;quot;Timescale Cloud vs. Amazon RDS PostgreSQL: Up to 350x Faster Queries, 44 % Faster Ingest, 95 % Storage Savings for Time-Series Data | TigerData&amp;quot;&lt;br /&gt;
[2]: https://www.tigerdata.com/blog/postgresql-timescaledb-1000x-faster-queries-90-data-compression-and-much-more &amp;quot;PostgreSQL + TimescaleDB: 1,000x Faster Queries, 90 % Data Compression, and Much More | TigerData&amp;quot;&lt;br /&gt;
[3]: https://grafana.com/blog/2022/04/08/how-we-scaled-our-new-prometheus-tsdb-grafana-mimir-to-1-billion-active-series/?utm_source=chatgpt.com &amp;quot;How we scaled our new Prometheus TSDB Grafana Mimir to 1 ...&amp;quot;&lt;br /&gt;
[4]: https://grafana.com/docs/loki/latest/operations/storage/tsdb/ &amp;quot;Single Store TSDB (tsdb) | Grafana Loki documentation&lt;br /&gt;
&amp;quot;&lt;br /&gt;
[5]: https://quickwit.io/blog/benchmarking-quickwit-loki &amp;quot;Benchmarking Quickwit vs. Loki | Quickwit&amp;quot;&lt;/div&gt;</summary>
		<author><name>Busk</name></author>
	</entry>
</feed>