Tiered Storage

Tacnode supports configurable tiered storage across different media, meeting business requirements for cost and performance. Built-in storage types include Hot and Cold storage. With the Tablespace feature, tables or indexes can be assigned to specific storage locations. Use Hot storage for workloads requiring high read/write performance and low latency. Cold storage suits scenarios needing lower storage costs and where performance is less critical.

Tablespace: a logical storage zone that defines the physical storage location of data. In Tacnode, tables, indexes, or entire databases can be bound to a designated Tablespace. After creating a Tablespace, you can assign it during Database, Table, or Index creation/modification. Each Tablespace can set a Location—currently, Tacnode supports /hot and /cold. /hot (default) assigns data to High-Performance SSD storage for frequently accessed data. /cold uses HDD storage for infrequently accessed data.

Note: Cold storage & cache binding recommendation

When using Cold storage in Nodegroup, it's recommended to bind a cache to improve access performance. Steps:

  1. Create cache

    • In Console, go to “Data” → “Cache”:
      • Create a new cache as needed
      • Or reuse existing cache resources (ensure capacity meets demand)
  2. Bind cache to Nodegroup

    • Bind created cache to the relevant Nodegroup

Manage Tablespace

Create Tablespace and Assign to Tiered Storage

CREATE TABLESPACE tablespace_name
    [ OWNER { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }]
    LOCATION 'location';
  • location: /hot for hot tier; /cold for cold tier.

Example:

-- Create tiered Tablespaces
CREATE TABLESPACE space_hot LOCATION '/hot';
CREATE TABLESPACE space_cold LOCATION '/cold';

Note: Creating a Tablespace requires Tacnode superuser privileges.

Drop Tablespace

DROP TABLESPACE [ IF EXISTS ] name;
 
DROP TABLESPACE space_cold;

Tablespace Usage

Associate Tables or Indexes with Tablespace

On table creation, assign data or indexes to a specific Tablespace. Partitioned tables inherit their parent’s tablespace by default; override with explicit specification if needed:

CREATE TABLESPACE space_hot LOCATION '/hot';
CREATE TABLESPACE space_cold LOCATION '/cold';
 
-- Store high-frequency tables in Hot storage
CREATE TABLE orders (
    id SERIAL PRIMARY KEY,
    user_id INT,
    created_at TIMESTAMP,
    amount NUMERIC
) TABLESPACE space_hot;
 
-- Archive low-frequency data in Cold storage
CREATE TABLE archived_orders (
    id SERIAL PRIMARY KEY,
    user_id INT,
    created_at TIMESTAMP,
    amount NUMERIC
) TABLESPACE space_cold;
 
-- Specify tablespace for index storage
CREATE INDEX idx_order_user_id ON orders (user_id) TABLESPACE space_hot;

Migrate Existing Data to Another Tablespace

Use ALTER TABLE ... SET TABLESPACE to move data—especially useful for gradual online tiering:

ALTER TABLE archived_orders SET TABLESPACE space_cold;

After migration, data files are automatically relocated to the new tablespace’s storage path. Changing the tablespace of a table or index rewrites all data; during compaction, storage usage temporarily doubles until completion.

Set Default Tablespace for Database

Use default_tablespace and temp_tablespaces to set the default tablespace for tables and temp tables:

CREATE TABLESPACE space_hot LOCATION '/hot';
CREATE TABLESPACE space_cold LOCATION '/cold';
 
set default_tablespace = space_hot;
set temp_tablespaces = space_cold;

When creating a Database, set default_tablespace; otherwise, defaults to /hot. To change an existing database’s default tablespace, reset default_tablespace.

ALTER DATABASE for tablespaces is not supported; modify using 'ALTER TABLE' or 'ALTER INDEX' for existing data.

Tiering Strategy for Partitioned Tables

Dynamically adjust storage strategies per business needs:

  • Combine the PARTITION BY mechanism with tiering: new (hot) partitions reside in Hot storage while older partitions migrate to Cold storage at lower cost—for example:

    CREATE TABLE orders (
        id SERIAL PRIMARY KEY,
        user_id INT,
        created_at TIMESTAMP,
        amount NUMERIC
    ) PARTITION BY RANGE (created_at);
     
    -- Hot storage partition
    CREATE TABLE orders_hot
        PARTITION OF orders
        FOR VALUES FROM ('2024-01-01') TO ('2024-12-31')
        TABLESPACE space_hot;
     
    -- Cold storage partition
    CREATE TABLE orders_cold
        PARTITION OF orders
        FOR VALUES FROM ('2023-01-01') TO ('2023-12-31')
        TABLESPACE space_cold;

On this page