migrate-postgres-tables-to-hypertables

migrate-postgres-tables-to-hypertables is a skill for Cursor from timescale/pg-aiguide. It costs 181 tokens per session (3,643 once invoked), scanned A, original, Apache-2.0.

A procedure for converting selected PostgreSQL tables into TimescaleDB hypertables, a table format designed for time-series data. It covers choosing a partition column, configuring the tables, and validating the migration.

In plain words
What is it for?
Use it when migrating identified PostgreSQL tables, planning a low-downtime or blue-green migration, and checking that the resulting hypertables are configured correctly.
Why use it?
It helps move large event-oriented tables to a time-series layout while considering query performance and migration risk.

Skill for Cursor

Written for Cursor: shipped in a Cursor plugin.

Part of the pg-aiguide plugin — 9 skills, 1 MCP server shipped together

Good fit Use it when migrating identified PostgreSQL tables, planning a low-downtime or blue-green migration, and checking that the resulting hypertables are configured correctly.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/timescale/pg-aiguide/migrate-postgres-tables-to-hypertables
About the project

pg-aiguide is a knowledge and tooling project that gives AI coding assistants version-aware PostgreSQL documentation and curated database practices. Developers use it through agent skills, an MCP server, or a Claude Code plugin to help coding tools generate better PostgreSQL code. The catalogue entries are its skills, instructions, MCP integration, and rule.

timescale/pg-aiguide · 1,835 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add timescale/pg-aiguide --skill migrate-postgres-tables-to-hypertables
Clone the repo
git clone --depth 1 https://github.com/timescale/pg-aiguide

Made for: Cursor.

Or install pg-aiguide, the plugin that ships this one along with the rest of its 9 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for migrate-postgres-tables-to-hypertables

README.md
[![agentmods](https://agentmods.dev/badge/skills/timescale/pg-aiguide/migrate-postgres-tables-to-hypertables/github.svg)](https://agentmods.dev/skills/timescale/pg-aiguide/migrate-postgres-tables-to-hypertables)
Your own site
<a href="https://agentmods.dev/skills/timescale/pg-aiguide/migrate-postgres-tables-to-hypertables"><img src="https://agentmods.dev/badge/skills/timescale/pg-aiguide/migrate-postgres-tables-to-hypertables/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for migrate-postgres-tables-to-hypertables

Your own site · 80×15
<a href="https://agentmods.dev/skills/timescale/pg-aiguide/migrate-postgres-tables-to-hypertables"><img src="https://agentmods.dev/badge/skills/timescale/pg-aiguide/migrate-postgres-tables-to-hypertables.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 181 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,643 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00181 $0.03643
Opus 5 $0.00090 $0.01821
Sonnet 5 $0.00036 $0.00729
Haiku 4.5 $0.00018 $0.00364

Measured 10d ago against content hash 1d52f9d8351a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

migrate-postgres-tables-to-hypertables scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/migrate-postgres-tables-to-hypertables/SKILL.md · 466 lines

How it starts

The opening of the file, as written. The whole thing — 466 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 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:

-- 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),...'
);

Sparse indexes on time column enable skipping compressed blocks outside queried time ranges.

Use when: ID correlates with time (newer records have higher IDs), need ID-based lookups, time queries also common

Chunk Interval Selection

-- Ensure statistics are current
ANALYZE your_table_name;

-- Estimate index size per time unit
WITH time_range AS (
    SELECT
        MIN(timestamp_column) as min_time,
        MAX(timestamp_column) as max_time,
        EXTRACT(EPOCH FROM (MAX(timestamp_column) - MIN(timestamp_column)))/3600 as total_hours
    FROM your_table_name
),
total_index_size AS (
    SELECT SUM(pg_relation_size(indexname::regclass)) as total_index_bytes
    FROM pg_stat_user_indexes
    WHERE schemaname||'.'||tablename = 'your_schema.your_table_name'
)
SELECT
    pg_size_pretty(tis.total_index_bytes / tr.total_hours) as index_size_per_hour
FROM time_range tr, total_index_size tis;

Read the full file on GitHub · 466 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 466 lines · 181 tokens per session scan A 1d52f9d8351a

Subscribe to this mod's changes

migrate-postgres-tables-to-hypertables is a skill published in the GitHub repository timescale/pg-aiguide (1,835 stars, last pushed yesterday), licensed Apache-2.0. It adds 181 tokens to every session and 3,643 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

database-optimizer

Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.

Jeffallan/claude-skills · 54 tokens

postgres-pro

Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.

Jeffallan/claude-skills · 41 tokens

pdlc-db-migrate

A database migration manager driven by database design documents. A migration is a versioned script that changes a database structure and can also undo that change.

kanfu-panda/pdlc-skills · 11 tokens

pdlc-db-design

A database design workflow that turns an existing product requirements document and, when available, API design into a database plan. It describes entities, fields, links, indexes, constraints, and an entity-relationship diagram, which shows how data types connect.

kanfu-panda/pdlc-skills · 8 tokens

database

ออกแบบ Database Schema สำหรับ PostgreSQL และ Laravel แบบ code-first สร้าง schema, relationships, business rules และ migration-ready guidance ใช้ skill นี้ทันทีเมื่อผู้ใช้พูดถึง database schema, table design, Entity-Relationship, Laravel migration, PostgreSQL model เช่น "ออกแบบ table ให้หน่อย", "ช่วยทำ ER diagram"…

natthasath/natthasath-marketplace · 112 tokens

sql-expert

Expert SQL query writing, optimization, and database schema design with support for PostgreSQL, MySQL, SQLite, and SQL Server. Use when working with databases for: (1) Writing complex SQL queries with joins, subqueries, and window functions, (2) Optimizing slow queries and analyzing execution plans, (3) Designing…

AutumnsGrove/ClaudeSkills · 106 tokens