Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Ian Doob Technology
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
TimeScale Notes
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Compression == === Check Distinct Values === <pre> -- n_distinct (-1 = Unique, 1 = All The Same) SELECT tablename, attname, most_common_vals, most_common_freqs, n_distinct FROM pg_stats -- WHERE tablename = '<TableName>'; WHERE schemaname = '<SchemaName>'; </pre> === Compress Table === <pre> ALTER TABLE crypto_ticks SET (timescaledb.compress, timescaledb.compress_segmentby='symbol', timescaledb.compress_orderby='time DESC'); </pre> <code>SELECT compress_chunk(c) from show_chunks('crypto_ticks') c; </code> === Check Compression === <pre> SELECT pg_size_pretty(before_compression_total_bytes) as before, pg_size_pretty(after_compression_total_bytes) as after FROM hypertable_compression_stats('crypto_ticks'); SELECT pg_size_pretty(hypertable_size('CRYPTO_TICKS')); </pre> === Compression Policy === Create a scheduled job that will compress all data with a 'time' column that is older than 8 days. </br> <pre>SELECT add_compression_policy('crypto_ticks', INTERVAL '8 days'); </pre> === Links === https://docs.timescale.com/tutorials/latest/financial-tick-data/financial-tick-compress Since version 2.18, HyperCore has been used for compression. </br> This uses a hybrid of row and columnar storage. </br> https://docs.timescale.com/use-timescale/latest/compression (Old) </br> https://docs.timescale.com/use-timescale/latest/hypercore] (New)
Summary:
Please note that all contributions to Ian Doob Technology may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
My wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width