moai-domain-database

Implements schema design, query optimization, and caching patterns for PostgreSQL, MongoDB, Redis, and Oracle.

Updated Jun 18, 2026
One-click install
npx skills add https://github.com/h102-log/pdfrag --skill moai-domain-database-h102-log
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: moai-domain-database
Source: https://github.com/h102-log/pdfrag/tree/main/.claude/skills/moai-domain-database
Command: npx skills add https://github.com/h102-log/pdfrag --skill moai-domain-database-h102-log

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Designing and optimizing databases across relational, document, and in-memory systems requires deep, platform-specific expertise that is hard to maintain across PostgreSQL, MongoDB, Redis, and Oracle simultaneously. ## Core Features & Use Cases - Multi-Database Patterns: Provides schema design, indexing, partitioning, and aggregation pipeline patterns for PostgreSQL, MongoDB, Redis, and Oracle. - Performance Optimization: Covers query analysis with EXPLAIN, materialized views, multi-layer caching with TTL strategies, and distributed locking. - Use Case: When building an application that stores structured user data in PostgreSQL, flexible profiles in MongoDB, and real-time status in Redis, use this Skill to implement a polyglot persistence router with proper cache invalidation. ## Quick Start Ask the database skill to design an optimized PostgreSQL schema with indexes for a user analytics workload.

Frequently Asked Questions about moai-domain-database

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

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

Run EXPLAIN ANALYZE BUFFERS on the slow query to identify full table scans, then create partial or composite indexes matching the filter columns. For frequent analytics, materialized views with concurrent refresh can reduce query time from seconds to milliseconds.

How to build a MongoDB aggregation pipeline for analytics?▼

Start with a $match stage backed by an index, then use $group for metrics, $lookup for joins, and $project to shape output. Create compound indexes on filter and sort fields, and enable allowDiskUse for large result sets.

What is the difference between cache-aside and write-through caching in Redis?▼

Cache-aside checks Redis first and populates it only on a miss, while write-through updates the database and cache together on every write. Both patterns require explicit cache invalidation on updates to avoid serving stale data.

Does python-oracledb support async connection pooling?▼

Yes, python-oracledb provides create_pool_async for async connection pools with configurable min, max, and increment settings. It also supports statement caching via stmtcachesize to improve repeated query performance.

Why does my Redis cache serve stale data after updates?▼

Stale data occurs when cache entries are not invalidated after database writes. Delete the specific cache key and any related key patterns immediately after updating the source data, and set appropriate TTLs as a safety net.

When should I use polyglot persistence instead of a single database?▼

Use polyglot persistence when different data types have distinct access patterns, such as structured records in PostgreSQL, flexible documents in MongoDB, and real-time counters in Redis. It adds synchronization complexity, so avoid it when one database handles all workloads adequately.