Skip to content

Improve retention policy documentation #880

Open
@daniel1302

Description

@daniel1302

Issue

People do not understand how to use retention policies in the data-node.

Some comments I shared with node operators

SQLStore.RetentionPeriod is a base/predefined retention policy. There are 3 options:

  • forever
  • standard
  • lite

I would recommend setting it up forever or at least standard, then you can adjust specific tables retention period:

  [[SQLStore.RetentionPolicies]]
    HypertableOrCaggName = "orders"
    DataRetentionPeriod = "30 days"

The orders table is the biggest table so far. It takes 90% of space in postgresql. In our archival nodes, We have 2.5TB of the data there.

See the screen, When I was experimenting with it some time ago.

image

You can use the following queries to obtain table sizes:

    SELECT
    table_name,
    table_bytes,
    index_bytes,
    toast_bytes,
    total_bytes
    FROM (
        SELECT
          pg_catalog.pg_namespace.nspname           AS schema_name,
          relname                                   AS table_name,
          (hypertable_detailed_size(pg_catalog.pg_class.oid)).*
        FROM pg_catalog.pg_class
          JOIN pg_catalog.pg_namespace ON relnamespace = pg_catalog.pg_namespace.oid
      ) t
    WHERE schema_name = 'public';
    SELECT
    table_name,
    size_bytes
    FROM (
        SELECT
          pg_catalog.pg_namespace.nspname           AS schema_name,
          relname                                   AS table_name,
          pg_relation_size(pg_catalog.pg_class.oid) AS size_bytes
        FROM pg_catalog.pg_class
          JOIN pg_catalog.pg_namespace ON relnamespace = pg_catalog.pg_namespace.oid
      ) t
    WHERE schema_name = 'public';

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions