
Migrate Postgres Tables To Hypertables
Takes a PostgreSQL table and converts it to a TimescaleDB hypertable with proper chunk intervals, compression settings, and primary key handling. The skill walks through partition column selection (usually a timestamp), calculates optimal chunk sizes based on your RAM and index sizes, and importantly asks permission before modifying any primary keys that don't include the partition column. For small tables it does in-place conversion, for larger ones it sets up blue-green migration. The compression configuration part is solid, helping you pick segment_by columns based on cardinality analysis. Use this after you've identified candidates, ideally with the companion find-hypertable-candidates skill first.
- skills.sh installs
- 368
- GitHub stars
- 1.9K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add timescale/pg-aiguide --skill migrate-postgres-tables-to-hypertables --agent claude-codeInstalls into .claude/skills of the current project.
Files
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
-- 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 occurredid,sequence_number- auto-increment (for sequential data without timestamps)ingested_at- less ideal, only if primary query dimensionupdated_at- AVOID (records updated out of order, breaks chunk distribution) unless primary query dimension
Sponsors
Details
- Repository
- github.com/timescale/pg-aiguide
- Categories
- Backend & APIs, Debugging, Productivity & Planning, Marketing & SEO, Databases
- License
- Apache-2.0
- First seen
- Jun 3, 2026