Home Programming Article

Encoding vs. Compression: Two Tools, Not Competitors

TL;DR

CedarDB demonstrates why data encoding and compression serve different purposes: encoding enables in-place queries while compression optimizes storage.

Key Points

  • Dictionary encoding achieves 168x faster filtering on string columns versus zstd by avoiding full decompression
  • Frame-of-reference encoding delivers 17.8x faster range queries on numeric columns through fixed-width deltas
  • Combined encoding + zstd compression achieves 9.59x total reduction on ClickBench hits table (75.56 GiB → 7.88 GiB)
  • Encoding operations complete in <30ms; zstd compression takes 19-33 seconds, making it storage-only in hot paths

Why It Matters

For database engineers and systems builders, this clarifies a fundamental design decision: encoding should always be applied for query performance, while compression is a separate storage optimization. Understanding when and why to layer these techniques can dramatically improve both query latency and disk utilization in analytics workloads.
Read the technical deep-dive

Source: cedardb.com