---
name: "postgres-timescaledb-hypertables"
description: "Partition time-series data seamlessly across time and space chunks using TimescaleDB."
metadata:
  author: "Timescale"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "create timescaledb hypertable"
  - "setup continuous aggregate"
  - "enable timescaledb compression"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# TimescaleDB Hypertables & Continuous Aggregates

Configures TimescaleDB hypertables, automated chunk sizing, continuous aggregates with real-time materialization, data retention policies, and native columnar compression for multi-terabyte metric feeds.

## When to Invoke
Invoke this skill whenever you need to:
- create timescaledb hypertable
- setup continuous aggregate
- enable timescaledb compression

## Execution SOP & Rules
1. Execute SELECT create_hypertable('metrics', 'timestamp', chunk_time_interval => INTERVAL '7 days').
2. Define continuous aggregates using CREATE MATERIALIZED VIEW ... WITH (timescaledb.continuous).
3. Add automated continuous aggregate refresh policies using add_continuous_aggregate_policy().
4. Activate columnar compression with ALTER TABLE ... SET (timescaledb.compress) and add_compression_policy().

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
