migrate-postgres-tables-to-hypertables
提供可验证的迁移流程,降低停机与性能风险,适合时序化改造。
在生产环境执行 DDL/迁移存在数据与锁定风险
将 PostgreSQL 表迁移为 TimescaleDB hypertable,含配置与验证步骤。
把选定的 PostgreSQL 表迁移成 TimescaleDB 的 hypertable,做到配置最优、停机最少并验证迁移成功。常用于时序数据量大、需要压缩和分区的场景,支持蓝绿迁移、大表无痛转换、并在迁移后配置 compression。特色是给出可执行的 SQL 步骤、验证方法和性能优化建议。
▸ 展开 SKILL.md 英文原文
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.
帮我安装这个 skill:https://raw.githubusercontent.com/timescale/pg-aiguide/main/skills/migrate-postgres-tables-to-hypertables/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/timescale/pg-aiguide/main/skills/migrate-postgres-tables-to-hypertables/SKILL.md"# 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) o