Database Indexing Strategy

Database Indexing Strategy

Guides a coding agent in designing database indexing strategies for PostgreSQL and MySQL: index types, composite and partial indexes, and maintenance.

Skill files6 files

references/

scripts/

templates/

SKILL.md71 lines
1
---
2
name: database-indexing-strategy
3
description: >
4
Design and implement database indexing strategies. Use when creating indexes,
5
choosing index types, or optimizing index performance in PostgreSQL and MySQL.
6
---
7
8
# Database Indexing Strategy
9
10
## Table of Contents
11
12
- [Overview](#overview)
13
- [When to Use](#when-to-use)
14
- [Quick Start](#quick-start)
15
- [Reference Guides](#reference-guides)
16
- [Best Practices](#best-practices)
17
18
## Overview
19
20
Design comprehensive indexing strategies to improve query performance, reduce lock contention, and maintain data integrity. Covers index types, design patterns, and maintenance procedures.
21
22
## When to Use
23
24
- Index creation and planning
25
- Query performance optimization through indexing
26
- Index type selection (B-tree, Hash, GiST, BRIN)
27
- Composite and partial index design
28
- Index maintenance and monitoring
29
- Storage optimization with indexes
30
- Full-text search index design
31
32
## Quick Start
33
34
**B-tree Indexes (Default):**
35
36
```sql
37
-- Standard equality and range queries
38
CREATE INDEX idx_users_email ON users(email);
39
CREATE INDEX idx_orders_created_at ON orders(created_at DESC);
40
41
-- Composite indexes for multi-column queries
42
CREATE INDEX idx_orders_user_status
43
ON orders(user_id, status)
44
WHERE cancelled_at IS NULL;
45
```
46
47
## Reference Guides
48
49
Detailed implementations in the `references/` directory:
50
51
| Guide | Contents |
52
|---|---|
53
| [PostgreSQL Index Types](references/postgresql-index-types.md) | PostgreSQL Index Types |
54
| [MySQL Index Types](references/mysql-index-types.md) | MySQL Index Types |
55
| [Single Column Indexes](references/single-column-indexes.md) | Single Column Indexes, Composite Indexes, Partial/Filtered Indexes, Expression Indexes |
56
57
## Best Practices
58
59
### ✅ DO
60
61
- Follow established patterns and conventions
62
- Write clean, maintainable code
63
- Add appropriate documentation
64
- Test thoroughly before deploying
65
66
### ❌ DON'T
67
68
- Skip testing or validation
69
- Ignore error handling
70
- Hard-code configuration values
71

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,341 prompts

More by @OpenSourceBuffGuy

See all
Walking POV down station steps onto a seaside train prompt image

Walking POV down station steps onto a seaside train

Generates a one-take first-person POV video of a morning commute in coastal Japan: station stairs, a stroked orange cat, a window seat and rails running beside the sea.

video-prompt, pov, single-take, vlog, timed-beats, handheld, japan, photorealistic, natural-light, ocean, animals, seedance, sound-effects, travel, cityscape, widescreen, camera-movement, long-form, negative-prompt

Kitten knight shields dragon egg in snowstorm prompt image

Kitten knight shields dragon egg in snowstorm

Directs a 24-second live-action fantasy short in which an armoured kitten shields a dragon egg in a snowstorm, with five timed scenes and a consistency block.

video-prompt, timed-beats, multi-shot, fantasy-world, creatures, animals, winter, character-consistency, cinematic, photorealistic, negative-prompt, guardrails, camera-movement, golden-hour, seedance, short-film, warriors, dramatic-lighting, long-form, shallow-depth-of-field

Smiling woman with ice cream by beach huts prompt image

Smiling woman with ice cream by beach huts

Draws a photorealistic 9:16 lifestyle portrait of a smiling woman with an ice cream cone on a pastel beach-hut promenade in golden-hour light.

image-prompt, nano-banana, portrait, woman, summer, golden-hour, natural-light, bokeh, vertical-format, photorealistic, medium-shot, fashion, vibrant-colors, pastel, ocean, soft-lighting, jewelry, for-photographers, for-content-creators

Reviews

Loading reviews…

Discussion

Loading comments…