A

Advanced Using Platform

Boost productivity using this guides, best, practices, working. Includes structured workflows, validation checks, and reusable patterns for database.

SkillClipticsdatabasev1.0.0MIT
0 views0 copies

Advanced Database Platform

A Claude Code skill for working with databases at an advanced level. Covers multi-database architectures, query optimization across database engines, data modeling patterns, migration strategies, and operational best practices for managing databases in production environments.

When to Use This Skill

Choose Advanced Database Platform when:

  • You need to design a multi-database architecture (SQL + NoSQL + Cache)
  • You want advanced query optimization across different database engines
  • You need to implement database sharding, replication, or partitioning
  • You're planning a database migration (engine change or major version upgrade)
  • You want production operational guidance (monitoring, backup, disaster recovery)

Consider alternatives when:

  • You need PostgreSQL-specific schema design (use a Postgres schema skill)
  • You want Supabase-specific optimization (use a Supabase skill)
  • You need a specific NoSQL database (use a database-specific skill)

Quick Start

# Install the skill claude install advanced-using-platform # Design a multi-database architecture claude "Design the data layer for an e-commerce platform: product catalog, user sessions, order processing, and analytics" # Optimize cross-database queries claude "My API queries PostgreSQL for user data and Redis for session data. How do I optimize the combined latency?" # Plan a database migration claude "Plan a migration from MongoDB to PostgreSQL for our user service with zero downtime"

Core Concepts

Database Selection Guide

WorkloadBest FitWhy
Transactional (OLTP)PostgreSQL, MySQLACID compliance, relational integrity
Analytical (OLAP)ClickHouse, BigQueryColumn-oriented, fast aggregations
CachingRedis, MemcachedIn-memory, sub-millisecond access
Document StorageMongoDB, DynamoDBFlexible schema, horizontal scaling
SearchElasticsearch, MeilisearchFull-text search, faceted filtering
Time SeriesTimescaleDB, InfluxDBTimestamp partitioning, retention policies
GraphNeo4j, DGraphRelationship-heavy queries

Multi-Database Patterns

Typical SaaS Architecture:
ā”œā”€ā”€ PostgreSQL (primary store)
│   → Users, accounts, subscriptions, core business data
│   → ACID transactions, relational queries
ā”œā”€ā”€ Redis (cache + sessions)
│   → Session storage, API rate limiting, hot data cache
│   → Sub-millisecond reads, TTL-based expiry
ā”œā”€ā”€ Elasticsearch (search)
│   → Full-text search, filtering, autocomplete
│   → Synced from PostgreSQL via change data capture
└── S3 (blob storage)
    → Files, images, backups, exports
    → Unlimited storage, lifecycle policies

Query Optimization Fundamentals

TechniqueApplies ToImpact
Proper IndexingAll SQL databases10-1000x speedup
Query PlanningPostgreSQL, MySQLIdentify full table scans
Connection PoolingAll databasesPrevent connection exhaustion
Read ReplicasAll databasesDistribute read load
Caching LayerAll databasesEliminate repeated queries
PartitioningLarge tables (100M+ rows)Faster queries on recent data

Configuration

ParameterTypeDefaultDescription
primary_dbstring"postgresql"Primary database engine
scalestring"medium"Scale: small (<1M rows), medium (1-100M), large (100M+)
availabilitystring"high"HA level: standard, high, mission_critical
environmentstring"cloud"Environment: local, cloud, hybrid
monitoringbooleantrueInclude monitoring setup

Best Practices

  1. Start with PostgreSQL, add specialized databases as needed — PostgreSQL handles 90% of workloads well. Only add Redis, Elasticsearch, or other databases when you have a specific performance need that PostgreSQL can't meet. Every additional database is operational overhead.

  2. Use connection pooling everywhere — Every database connection consumes memory and resources. Use PgBouncer for PostgreSQL, connection pools in your ORM, and client-side pooling for Redis. Connection exhaustion is the number one production database issue.

  3. Monitor query performance continuously — Set up slow query logging with a 100ms threshold. Review the slowest queries weekly. A single unindexed query can bring down a production database under load.

  4. Automate backups and test restores — Automated backups that have never been tested are hope, not a backup strategy. Schedule monthly restore tests to verify backup integrity and practice the restore procedure.

  5. Use read replicas for read-heavy workloads — Most applications are 90% reads. Route read queries to replicas and writes to the primary. This is the simplest way to scale database performance without sharding.

Common Issues

Database connection errors under load — You're running out of connections. Implement connection pooling, reduce connection timeout values, and ensure connections are released promptly after use. Check for connection leaks in error paths.

Slow queries that were fast before — Table growth changes query plans. As tables grow from thousands to millions of rows, queries that worked fine start doing full table scans. Run EXPLAIN ANALYZE on slow queries and add indexes for the new data volume.

Data inconsistency between databases — When using multiple databases, eventual consistency is expected. For critical operations, write to the primary database first and sync to secondary databases asynchronously. Don't rely on multi-database transactions.

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates