
Migrate postgres tables to hypertables
Guides an agent through converting PostgreSQL tables into TimescaleDB hypertables safely
Migrate postgres tables to hypertables is an open-source agent skill for databases. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.
- Scripts
- None
- Platforms
- Claude Code, Codex, Cursor
- GitHub stars
- 1.9K
- Last commit
- License
- Apache-2.0
- Listing updated
Similar skills
About Migrate postgres tables to hypertables
This skill walks an agent through planning and running the conversion of existing PostgreSQL tables into TimescaleDB hypertables. It covers choosing a partition column, sizing chunk intervals from index size against available memory, and checking primary key and unique constraints so they include the partition column. It also reviews foreign keys, since hypertable-to-hypertable references are not supported, and sets up columnstore compression with segment and order keys.
The skill offers two migration paths: an in-place conversion for smaller tables and a blue-green approach that copies data in batches and swaps tables during a maintenance window for large ones. Before changing constraints or dropping indexes, the agent is told to ask for the user's permission. After migration, it provides queries to check chunk layout, compression ratios and query plans, and it lists signs that the migration should be investigated.
The skill expects a PostgreSQL 15+ database with TimescaleDB available and SQL access to run the queries. It is written as SQL for psql-style execution and does not include bundled scripts.
When your agent uses it
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.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 1 file (15 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the pg plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add timescale/pg-aiguide
/plugin install pg@aiguideOr copy only this skill to ~/.claude/skills/migrate-postgres-tables-to-hypertables:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/migrate-postgres-tables-to-hypertables &&
cp -R "$tmp/skills/migrate-postgres-tables-to-hypertables" ~/.claude/skills/migrate-postgres-tables-to-hypertables &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/migrate-postgres-tables-to-hypertables inside it instead.
Copy the skill folder to ~/.agents/skills/migrate-postgres-tables-to-hypertables to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/migrate-postgres-tables-to-hypertables &&
cp -R "$tmp/skills/migrate-postgres-tables-to-hypertables" ~/.agents/skills/migrate-postgres-tables-to-hypertables &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/migrate-postgres-tables-to-hypertables inside it instead.
Copy the skill folder to ~/.cursor/skills/migrate-postgres-tables-to-hypertables to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/migrate-postgres-tables-to-hypertables &&
cp -R "$tmp/skills/migrate-postgres-tables-to-hypertables" ~/.cursor/skills/migrate-postgres-tables-to-hypertables &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/migrate-postgres-tables-to-hypertables inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/timescale/pg-aiguide.git --path skills/migrate-postgres-tables-to-hypertablesOr copy the folder to ~/.gemini/skills/migrate-postgres-tables-to-hypertables yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/migrate-postgres-tables-to-hypertables:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/migrate-postgres-tables-to-hypertables &&
cp -R "$tmp/skills/migrate-postgres-tables-to-hypertables" ~/.copilot/skills/migrate-postgres-tables-to-hypertables &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/migrate-postgres-tables-to-hypertables inside it instead.
Get the folder:
git clone --depth 1 https://github.com/timescale/pg-aiguide.gitThen copy pg-aiguide/skills/migrate-postgres-tables-to-hypertables into your agent's skills folder as migrate-postgres-tables-to-hypertables. Agents that support SKILL.md read one folder per skill.
What it does
- Partition column selection
- Helps pick a time or sequential integer column that reflects when events occurred.
- Chunk interval sizing
- Calculates a chunk interval from index size per hour and available memory.
- Constraint compatibility checks
- Finds primary keys and unique constraints that must be extended to include the partition column.
- In-place and blue-green paths
- Offers a direct conversion for small tables and a batched table swap for large ones.
- Compression setup
- Configures segment and order keys, sparse indexes and a columnstore policy.
- Post-migration validation
- Provides queries for chunk exclusion, compression ratios and query plan comparison.
Good for
- Convert a large sensor readings table into a hypertable with minimal downtime
- Pick a partition column and chunk interval for an events table
- Check whether a primary key must change before converting a table
- Set up compression on a converted metrics table
- Verify that a hypertable migration improved query performance
Migrate postgres tables to hypertables FAQ
What does the skill need before Migrate postgres tables to hypertables runs?
Tables already identified as hypertable candidates, PostgreSQL 15+ with TimescaleDB, and the find-hypertable-candidates skill if candidates are not yet known.
Does Migrate postgres tables to hypertables change the database automatically?
It provides SQL for migration steps, but it asks the user for permission before modifying primary keys, unique constraints or dropping indexes or foreign keys.
When should blue-green migration be used?
The skill suggests in-place conversion for tables under 1GB and blue-green migration for larger tables, with batched copying and a maintenance-window swap.
Which default chunk interval does Migrate postgres tables to hypertables recommend?
It says to keep the 7-day default if unsure, and to calculate a different interval from index size when there is data to measure.
How do I install Migrate postgres tables to hypertables in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/migrate-postgres-tables-to-hypertables to use it in all your projects, or to .claude/skills/migrate-postgres-tables-to-hypertables in one project. Or install the pg plugin, which includes it: /plugin marketplace add timescale/pg-aiguide, then /plugin install pg@aiguide.
Does Migrate postgres tables to hypertables run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Migrate postgres tables to hypertables?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Migrate postgres tables to hypertables?
The closest alternatives to Migrate postgres tables to hypertables are Find hypertable candidates, Setup timescaledb hypertables, Postgres, Design postgres tables and Postgres database migration.
Where this comes from
- Description: from the skill's own SKILL.md.
More from timescale/pg-aiguide

Guides an agent in designing PostGIS spatial tables, types, SRIDs and indexes
- Open source
- 1.9K GitHub stars
- Databases

Guides an agent through PostgreSQL table design, types, constraints and indexing
- Open source
- 1.9K GitHub stars
- Databases

Scores existing PostgreSQL tables to find which should become TimescaleDB hypertables
- Open source
- 1.9K GitHub stars
- Databases

Guides an agent through pgvector setup, HNSW indexing and tuning for semantic search
- Open source
- 1.9K GitHub stars
- Databases

Guides an agent through PostgreSQL schema design, indexing, search, TimescaleDB
- Open source
- 1.9K GitHub stars
- Databases

Guides an agent through planning, testing and running PostgreSQL schema migrations safely
- Open source
- 1.9K GitHub stars
- Databases

