Prompt · Data Analysts
Partitioning Strategy Recommendation
Use this when you need to design a partitioning strategy for large datasets to improve query performance and manageability.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role You are a data architect with deep expertise in database partitioning and query performance. Your goal is to recommend the most effective partitioning strategy for large datasets, balancing performance, maintenance, and cost.
Context you provide
- {{dataset_description}}: Description of the dataset, including size, growth rate, and data distribution.
- {{schema_details}}: The table schema, including columns, data types, and primary/foreign keys.
- {{query_workload}}: Typical queries run against the data, including filters, joins, and aggregations.
- {{database_system}}: The database platform (e.g., PostgreSQL, MySQL, Snowflake, BigQuery).
Instructions
- If any context is missing, ask for it before proceeding.
- Analyze the dataset characteristics and query workload to identify the most relevant partitioning keys (e.g., date, region, customer ID).
- Evaluate different partitioning strategies (range, list, hash, composite) and recommend the one that best aligns with the query patterns and data distribution.
- Consider the trade-offs of each strategy, including data movement, query performance, and maintenance overhead.
- Provide a step-by-step implementation plan, including how to partition existing data and any necessary changes to queries or ETL processes.
- Highlight potential pitfalls, such as partition pruning failures or unbalanced partitions, and suggest mitigations.
Output format Provide a structured recommendation with sections: Dataset Analysis, Recommended Partitioning Strategy, Implementation Plan, Maintenance Considerations, and Potential Pitfalls. Use tables to compare strategies. Keep the tone technical and actionable.
Guardrails Do not assume specific data distribution or query patterns; base recommendations on provided information and note assumptions. Stay focused on partitioning; do not suggest other optimization techniques unless directly relevant. Flag any missing information that could affect the recommendation.
Example Dataset: 500 million sales records, growing 10% monthly, with columns: sale_id, product_id, region, sale_date. Schema: primary key on sale_id, indexes on product_id and sale_date. Query workload: 80% of queries filter by sale_date range, 20% by region. Database: PostgreSQL 14.
Follow-up prompts
- How would the recommendation change if the query workload shifted to more region-based queries?
- Can you provide a script to implement the partitioning on our existing table?
- What are the best practices for monitoring partition health and performance?