Skip to content

Commit

Permalink
Extend blockchain compression section
Browse files Browse the repository at this point in the history
Extending the introduction of compression for the blockchain tutorial
by giving some more background and some links.
  • Loading branch information
mkindahl committed Nov 7, 2023
1 parent 0700bca commit bea2812
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
34 changes: 29 additions & 5 deletions tutorials/blockchain-query/blockchain-compress.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,34 @@ content_group: Query the Bitcoin blockchain

# Set up compression and compress the dataset

This tutorial uses a dataset that contains Bitcoin blockchain data for
the past five days, in a hypertable named `transactions`.

Storing a lot of data can be expensive. Using compression, you can store
the same dataset much more efficiently and potentially query it even faster.
You have now seen how to create a hypertable for your Bitcoin dataset
and query it for blockchain data. When ingesting a dataset like this
is seldom necessary to update old data and over time the amount of
data in the tables grows. Over time you end up with a lot of data and
since this is mostly immutable you can compress it to save space and
avoid incurring additional cost.

It is possible to use disk-oriented compression like the support
offered by ZFS and Btrfs but since TimescaleDB is build for handling

Check warning on line 20 in tutorials/blockchain-query/blockchain-compress.md

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Acronyms] Spell out 'ZFS', if it's unfamiliar to the audience. Raw Output: {"message": "[Google.Acronyms] Spell out 'ZFS', if it's unfamiliar to the audience.", "location": {"path": "tutorials/blockchain-query/blockchain-compress.md", "range": {"start": {"line": 20, "column": 12}}}, "severity": "INFO"}

Check warning on line 20 in tutorials/blockchain-query/blockchain-compress.md

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'Btrfs'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'Btrfs'?", "location": {"path": "tutorials/blockchain-query/blockchain-compress.md", "range": {"start": {"line": 20, "column": 20}}}, "severity": "WARNING"}
event-oriented data (such as time-series) it comes with support for
compressing data in hypertables.

TimescaleDB compression allows you to store the data in a vastly more
efficient format allowing up to 20x compression ratio compared to a
normal PostgreSQL table, but this is of course highly dependent on the
data and configuration.

TimescaleDB compression is implemented natively in PostgreSQL and does
not require special storage formats. Instead it relies on features of
PostgreSQL to transform the data into columnar format before
compression. The use of a columnar format allows better compression
ratio since similar data is stored adjacently. For more details on how
the compression format looks, you can look at the [compression
design][compression-design] section.

A beneficial side-effect of compressing data is that certain queries
are significantly faster since less data has to be read into
memory.

<Procedure>

Expand Down Expand Up @@ -111,3 +134,4 @@ Try it yourself and see what you get!

[segment-by-columns]: /use-timescale/:currentVersion:/compression/about-compression/#segment-by-columns
[automatic-compression]: /tutorials/:currentVersion:/blockchain-query/blockchain-compress/#automatic-compression
[compression-design]: /use-timescale/:currentVersion:/compression/compression-design/
5 changes: 5 additions & 0 deletions use-timescale/page-index/page-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ module.exports = [
href: "about-compression",
excerpt: "Learn about how compression works",
},
{
title: "Compression design",
href: "compression-design",
excerpt: "The design of TimescaleDB compression",
},
{
title: "About compression methods",
href: "compression-methods",
Expand Down

0 comments on commit bea2812

Please sign in to comment.