postgres-patterns

Provides PostgreSQL reference for query optimization, indexing, schema design, and security patterns.

1|Updated Oct 14, 2023
One-click install
npx skills add https://github.com/walterfan/lazy-ai-primer --skill postgres-patterns-walterfan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/walterfan/lazy-ai-primer/tree/main/assets/skills/postgres-patterns
Command: npx skills add https://github.com/walterfan/lazy-ai-primer --skill postgres-patterns-walterfan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides quick access to best practices for PostgreSQL, helping developers optimize queries, design schemas, and secure their databases effectively.

Core Features & Use Cases

  • Query Optimization: Learn efficient indexing strategies and common SQL patterns.
  • Schema Design: Understand recommended data types and avoid common pitfalls.
  • Security: Implement Row Level Security (RLS) and secure database configurations.
  • Use Case: When writing a complex SQL query that's performing slowly, consult this Skill for index recommendations or to identify potential anti-patterns.

Quick Start

Use the postgres-patterns skill to find an example of a composite index for a WHERE clause with equality and range conditions.

Frequently Asked Questions about postgres-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize a slow PostgreSQL query with indexing?

To optimize a slow PostgreSQL query, you should apply proper indexing strategies like using composite indexes for WHERE clauses with equality and range conditions. This Skill provides quick reference for identifying query anti-patterns and recommends efficient SQL patterns to improve execution speed.

What are the best practices for PostgreSQL schema design?

PostgreSQL schema design best practices involve selecting recommended data types and avoiding common structural pitfalls. This Skill provides guidelines to help developers structure databases efficiently, ensuring maintainable schemas based on established guidelines like those from Supabase.

How do I implement Row Level Security in PostgreSQL?

Implementing Row Level Security (RLS) in PostgreSQL involves configuring secure database policies to restrict data access. This Skill provides quick reference for security best practices, helping you apply RLS and secure database configurations effectively.

What are common PostgreSQL anti-patterns I should avoid?

Common PostgreSQL anti-patterns include inefficient SQL structures and improper data type selection. This Skill helps detect these anti-patterns by providing quick reference to common SQL mistakes, ensuring you follow established database development guidelines.

When should I use a composite index in PostgreSQL?

You should use a composite index in PostgreSQL when dealing with WHERE clauses that contain both equality and range conditions. This Skill provides quick reference examples for such indexing strategies to facilitate efficient database query optimization.