Agent skill

Managing Database Partitions

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Process use when you need to work with database partitioning.

MITAuto-check passedDatabases

Install Managing Database Partitions

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-partitions -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace managing-database-partitions --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/managing-database-partitions .claude/skills/managing-database-partitions && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
managing-database-partitions
GitHub stars
2.8k
Token cost
~1.8k tokens
SKILL.md length
873 words
Files
4 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Process use when you need to work with database partitioning.

  • Works in 10 steps: Identify partitioning candidates by… → Select the partition key based on the… → Choose the partitioning strategy → …
  • You need to work with database partitioning
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • With phrases like partition tables

What it does

Managing Database Partitions is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database partitioning. This skill provides table partitioning strategies with comprehensive guidance and automation. Trigger with phrases like "partition tables", "implement partitioning", or "optimize large tables".

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including scripts, reference files and assets (for example `assets/README.md`, `references/README.md` and `scripts/README.md`). Compatibility notes: Designed for Claude Code

It sits in Databases. It works with PostgreSQL and MySQL. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • You need to work with database partitioning
  • With phrases like partition tables
  • Implement partitioning
  • Optimize large tables

Example prompts

  • “partition tables”
  • “implement partitioning”
  • “optimize large tables”
  • “/managing-database-partitions”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Identify partitioning candidates by finding tables that exceed 10GB or 100M rows, have time-based query patterns, or require periodic data…
  2. Select the partition key based on the most common query filter column. For time-series data, use the timestamp column. For multi-tenant…
  3. Choose the partitioning strategy
  4. For PostgreSQL, create the partitioned parent table: CREATE TABLE orders (id bigint, created_at timestamptz, ...) PARTITION BY RANGE…
  5. For MySQL, define partitions inline: ALTER TABLE orders PARTITION BY RANGE (YEAR(created_at) * 100 + MONTH(created_at)) (PARTITION p202401…
  6. Migrate data from an existing unpartitioned table to a partitioned table
  7. Create indexes on each partition. In PostgreSQL, indexes on the parent table automatically propagate to child partitions. Create the…
  8. Automate future partition creation with a scheduled script or cron job. For monthly range partitions, create the next 3 months of…
  9. Implement partition maintenance: drop or detach old partitions for data retention (ALTER TABLE orders DETACH PARTITION orders_2022_01)…
  10. Verify partition pruning works by running EXPLAIN on typical queries and confirming only relevant partitions are scanned. Look for…

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(psql:*)
    • Bash(mysql:*)
    • Bash(mongosh:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/, which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • postgresql.org
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Managing Database Partitions loads about 1.8k tokens when it runs, and up to ~1.9k if it reads all its reference files. Until then it costs about 71 tokens; SKILL.md has 873 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~71
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 873 words, ~1,840 tokens.

Download SKILL.mdSave it as .claude/skills/managing-database-partitions/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
managing-database-partitions
description
Process use when you need to work with database partitioning. This skill provides table partitioning strategies with comprehensive guidance and automation. Trigger with phrases like "partition tables", "implement partitioning", or "optimize large tables".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)
compatibility
Designed for Claude Code
version
1.25.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
database, database-partitions

Database Partition Manager

Overview

Implement and manage table partitioning for PostgreSQL and MySQL to improve query performance and simplify data lifecycle management on large tables. This skill covers range partitioning (by date or ID), list partitioning (by category or region), hash partitioning (for even distribution), and composite partitioning.

Prerequisites

  • PostgreSQL 10+ (declarative partitioning) or MySQL 5.7+ (native partitioning)
  • Database admin credentials with CREATE TABLE and ALTER TABLE permissions
  • psql or mysql CLI for executing partition DDL
  • Table size metrics: SELECT pg_size_pretty(pg_total_relation_size('table_name')) or SELECT data_length FROM information_schema.TABLES
  • Query patterns on the target table (especially WHERE clause columns used for filtering)
  • Maintenance window availability for initial partition migration on existing tables

Instructions

  1. Identify partitioning candidates by finding tables that exceed 10GB or 100M rows, have time-based query patterns, or require periodic data purging. Query pg_stat_user_tables to find tables with high sequential scan counts on large row sets.

  2. Select the partition key based on the most common query filter column. For time-series data, use the timestamp column. For multi-tenant data, use tenant_id. The partition key must appear in most WHERE clauses to enable partition pruning.

  3. Choose the partitioning strategy:

    • Range: Best for time-series data. Create monthly or daily partitions. Queries filtering by date range scan only relevant partitions.
    • List: Best for categorical data. Create one partition per category, region, or status value.
    • Hash: Best for even distribution when no natural range exists. Distribute rows across N partitions using hash of the partition key.
    • Composite: Combine range + list for multi-dimensional partitioning (e.g., range by date, then list by region).
  4. For PostgreSQL, create the partitioned parent table: CREATE TABLE orders (id bigint, created_at timestamptz, ...) PARTITION BY RANGE (created_at). Then create child partitions: CREATE TABLE orders_2024_01 PARTITION OF orders FOR VALUES FROM ('2024-01-01') TO ('2024-02-01').

  5. For MySQL, define partitions inline: ALTER TABLE orders PARTITION BY RANGE (YEAR(created_at) * 100 + MONTH(created_at)) (PARTITION p202401 VALUES LESS THAN (202402), ...).

  6. Migrate data from an existing unpartitioned table to a partitioned table:

    • Create the new partitioned table with identical schema
    • Copy data in batches: INSERT INTO orders_partitioned SELECT * FROM orders_old WHERE created_at BETWEEN ... AND ...
    • Verify row counts match between old and new tables
    • Rename tables atomically: ALTER TABLE orders RENAME TO orders_old; ALTER TABLE orders_partitioned RENAME TO orders;
  7. Create indexes on each partition. In PostgreSQL, indexes on the parent table automatically propagate to child partitions. Create the primary key and any secondary indexes on the partitioned table.

  8. Automate future partition creation with a scheduled script or cron job. For monthly range partitions, create the next 3 months of partitions in advance to prevent INSERT failures when a new month begins.

  9. Implement partition maintenance: drop or detach old partitions for data retention (ALTER TABLE orders DETACH PARTITION orders_2022_01), then archive or delete the detached partition. This is vastly faster than DELETE FROM orders WHERE created_at < '2023-01-01'.

  10. Verify partition pruning works by running EXPLAIN on typical queries and confirming only relevant partitions are scanned. Look for "Partitions: 1/24" in the plan output indicating effective pruning.

Show full SKILL.md (372 more words)Show less

Output

  • Partition DDL scripts for creating partitioned tables and child partitions
  • Data migration scripts for moving data from unpartitioned to partitioned tables
  • Partition maintenance scripts for automated creation, detachment, and archival
  • Partition pruning verification queries confirming optimizer uses partition elimination
  • Cron job configurations for scheduled partition creation and cleanup

Error Handling

ErrorCauseSolution
no partition of relation "table" found for rowINSERT targets a range with no matching partitionCreate the missing partition; implement automated partition pre-creation for future ranges
Partition pruning not occurringQuery filter does not use the partition key, or uses a function on the key columnRewrite query to filter directly on the partition key column; avoid wrapping partition key in functions
Slow data migration from unpartitioned tableSingle large INSERT/SELECT locks the table and fills WALMigrate in batches by partition range; use pg_repack for online migration; increase maintenance_work_mem and max_wal_size
Foreign key references prevent partitioningPostgreSQL does not support foreign keys referencing partitioned tables (pre-v12)Upgrade to PostgreSQL 12+; or remove FK constraints and enforce referential integrity at application level
Too many partitions causing planner slowdownHundreds or thousands of child partitions degrade query planning timeUse wider partition ranges (monthly instead of daily); enable enable_partition_pruning; consider sub-partitioning instead of flat partitioning

Examples

Monthly range partitioning for an events table: A 500GB events table with 2B rows partitioned by created_at into monthly partitions. Queries filtering by date range (last 7 days, last month) now scan only 1-2 partitions instead of the full table. Partition drop replaces a 4-hour DELETE operation with a sub-second DDL command for monthly data purges.

Hash partitioning for a sessions table: A sessions table with random UUID primary keys and no natural range column. Hash partition by session_id across 16 partitions to distribute I/O evenly. Parallel sequential scans across partitions improve full-table analytic queries by 8x on an 8-core server.

Composite partitioning for multi-region SaaS: Orders table partitioned first by range on created_at (monthly), then by list on region (us-east, us-west, eu, asia). Queries for "all US orders this month" prune to just 2 of 48 total partitions, reducing scan volume by 96%.

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts, references, assets) in skills/.curated/managing-database-partitions of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Managing Database Partitions next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Managing Database Partitions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Managing Database Partitions this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.8kAutomated safety check: PassMIT
How To Communicatedatabasus/databasus8.9k—~3.9kAutomated safety check: PassMIT
SQL Database Support for pRESTprest/prest4.6k—~1.6kAutomated safety check: PassMIT
Chdb SQLvemetric/vemetric3951 repos~1.2kAutomated safety check: PassApache-2.0
PR Triagewannabespace/conar1.5k—~811Automated safety check: PassAGPL-3.0
Database DesignMoizIbnYousaf/ai-agent-skills1.1k1 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • How To Communicate

    databasus/databasus

    Communicate clearly in every response, progress update and agent-authored document.

    8.9k GitHub stars~3.9k tokensUpdated today
    DatabasesAuto-check passed
  • Guides classifying, gap-analyzing and scaffolding support for a new SQL database in pREST, from Postgres-compatible variants to entirely new dialects.

    4.6k GitHub stars~1.6k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Chdb SQL

    vemetric/vemetric

    A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…

    395 GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed
  • PR Triage

    wannabespace/conar

    Speed up a GitHub PR review — sort every changed file into trivial / skim / review, mark the trivial ones as viewed on GitHub, and hand back a reading order for the rest.

    1.5k GitHub stars~811 tokensUpdated yesterday
    DatabasesAuto-check passed
  • Database Design

    MoizIbnYousaf/ai-agent-skills

    Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases.

    1.1k GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed
  • Sql2er

    ystemsrx/sql_to_ER

    A skill your agent uses when the user wants a Chen-model ER diagram from SQL CREATE TABLE statements or DBML, wants to rearrange or clean up an existing sql2er state, wants a skeleton-only overview…

    188 GitHub stars~1.1k tokensUpdated 10 days ago
    DatabasesAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Managing Database Partitions

What does Managing Database Partitions do?

Process use when you need to work with database partitioning. Managing Database Partitions is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database partitioning.

When should I use Managing Database Partitions?

Managing Database Partitions fits situations like: you need to work with database partitioning; with phrases like partition tables; implement partitioning; optimize large tables.

How do I install Managing Database Partitions in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-partitions -a claude-code`. Or copy the skill folder (skills/.curated/managing-database-partitions in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/managing-database-partitions in your project. Claude Code loads it when a task matches its description.

How do I install Managing Database Partitions in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-partitions -a codex`. Or copy the skill folder (skills/.curated/managing-database-partitions in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/managing-database-partitions in your project. Codex loads it when a task matches its description.

Can I use Managing Database Partitions in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill managing-database-partitions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/managing-database-partitions, .gemini/skills/managing-database-partitions, .github/skills/managing-database-partitions and .opencode/skills/managing-database-partitions in your project.

What does Managing Database Partitions need to run?

SKILL.md names no scripts, command-line tools or credentials: Managing Database Partitions is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Managing Database Partitions access the network?

SKILL.md names 2 domains. As links in the text: postgresql.org and github.com. This is read from the text; nothing was executed.

Is Managing Database Partitions safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Managing Database Partitions use?

Managing Database Partitions is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Managing Database Partitions use?

About 1.8k tokens (SKILL.md is roughly 7.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 18 tokens, read only when the agent opens those files.

What are the alternatives to Managing Database Partitions?

Skills that share tags, products or a category with Managing Database Partitions: How To Communicate (databasus/databasus, 8.9k stars), SQL Database Support for pREST (prest/prest, 4.6k stars), Chdb SQL (vemetric/vemetric, 395 stars) and PR Triage (wannabespace/conar, 1.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Managing Database Partitions?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.