migrate-postgres-tables-to-hypertables

Solid

Use this skill to migrate identified PostgreSQL tables to Timescale/TimescaleDB hypertables with optimal configuration and validation. **Trigger when user asks to:** - Migrate or convert PostgreSQL tables to hypertables - Execute hypertable migration with minimal downtime - Plan blue-green migration for large tables - Validate hypertable migration success - Configure compression after migration **Prerequisites:** Tables already identified as candidates (use find-hypertable-candidates first if needed) **Keywords:** migrate to hypertable, convert table, Timescale, TimescaleDB, blue-green migration, in-place conversion, create_hypertable, migration validation, compression setup Step-by-step migration planning including: partition column selection, chunk interval calculation, PK/constraint handling, migration execution (in-place vs blue-green), and performance validation queries.

API & Backend 1,751 stars 94 forks Updated 1 weeks ago Apache-2.0

Install

View on GitHub

Quality Score: 97/100

Stars 20%
100
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# PostgreSQL to TimescaleDB Hypertable Migration Migrate identified PostgreSQL tables to TimescaleDB hypertables with optimal configuration, migration planning and validation. **Prerequisites**: Tables already identified as hypertable candidates (use companion "find-hypertable-candidates" skill if needed). ## Step 1: Optimal Configuration ### Partition Column Selection ```sql -- Find potential partition columns SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name = 'your_table_name' AND data_type IN ('timestamp', 'timestamptz', 'bigint', 'integer', 'date') ORDER BY ordinal_position; ``` **Requirements:** Time-based (TIMESTAMP/TIMESTAMPTZ/DATE) or sequential integer (INT/BIGINT) Should represent when the event actually occurred or sequential ordering. **Common choices:** - `timestamp`, `created_at`, `event_time` - when event occurred - `id`, `sequence_number` - auto-increment (for sequential data without timestamps) - `ingested_at` - less ideal, only if primary query dimension - `updated_at` - AVOID (records updated out of order, breaks chunk distribution) unless primary query dimension #### Special Case: table with BOTH ID AND Timestamp When table has sequential ID (PK) AND timestamp that correlate: ```sql -- Partition by ID, enable minmax sparse indexes on timestamp SELECT create_hypertable('orders', 'id', chunk_time_interval => 1000000); ALTER TABLE orders SET ( timescaledb.sparse_index = 'minmax(created_at),...' ); `...

Details

Author
timescale
Repository
timescale/pg-aiguide
Created
10 months ago
Last Updated
1 weeks ago
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

API & Backend Listed

migrate-postgres-tables-to-hypertables

Comprehensive guide for migrating PostgreSQL tables to TimescaleDB hypertables with optimal configuration and performance validation

1 Updated today
jhonny028966
API & Backend Solid

find-hypertable-candidates

Use this skill to analyze an existing PostgreSQL database and identify which tables should be converted to Timescale/TimescaleDB hypertables. **Trigger when user asks to:** - Analyze database tables for hypertable conversion potential - Identify time-series or event tables in an existing schema - Evaluate if a table would benefit from Timescale/TimescaleDB - Audit PostgreSQL tables for migration to Timescale/TimescaleDB/TigerData - Score or rank tables for hypertable candidacy **Keywords:** hypertable candidate, table analysis, migration assessment, Timescale, TimescaleDB, time-series detection, insert-heavy tables, event logs, audit tables Provides SQL queries to analyze table statistics, index patterns, and query patterns. Includes scoring criteria (8+ points = good candidate) and pattern recognition for IoT, events, transactions, and sequential data.

1,751 Updated 1 weeks ago
timescale
API & Backend Listed

find-hypertable-candidates

Analyze an existing PostgreSQL database to identify tables that would benefit from conversion to TimescaleDB hypertables

1 Updated today
jhonny028966
API & Backend Solid

setup-timescaledb-hypertables

Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. **Trigger when user asks to:** - Create or design SQL schemas/tables AND Timescale/TimescaleDB/TigerData/Tiger Cloud is available - Set up hypertables, compression, retention policies, or continuous aggregates - Configure partition columns, segment_by, order_by, or chunk intervals - Optimize time-series database performance or storage - Create tables for sensors, metrics, telemetry, events, or transaction logs **Keywords:** CREATE TABLE, hypertable, Timescale, TimescaleDB, time-series, IoT, metrics, sensor data, compression policy, continuous aggregates, columnstore, retention policy, chunk interval, segment_by, order_by Step-by-step instructions for hypertable creation, column selection, compression policies, retention, continuous aggregates, and indexes.

1,751 Updated 1 weeks ago
timescale
API & Backend Listed

setup-timescaledb-hypertables

Step-by-step instructions for designing table schemas and setting up TimescaleDB with hypertables, indexes, compression, retention policies, and continuous aggregates. Instructions for selecting: partition columns, segment_by columns, order_by columns, chunk time interval, real-time aggregation.

1 Updated today
jhonny028966