nw-query-optimization

Analyze execution plans and design indexes for SQL and NoSQL queries.

Updated Mar 18, 2024
One-click install
npx skills add https://github.com/v1bh0r/precise-ledger-pro --skill nw-query-optimization-v1bh0r
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nw-query-optimization
Source: https://github.com/v1bh0r/precise-ledger-pro/tree/main/nWave/skills/nw-query-optimization
Command: npx skills add https://github.com/v1bh0r/precise-ledger-pro --skill nw-query-optimization-v1bh0r

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many data-driven applications suffer from suboptimal query performance due to poorly chosen execution plans, missing or misused indexes, and suboptimal join strategies across SQL and NoSQL systems.

Core Features & Use Cases

  • Cost-based optimization fundamentals: understand how optimizers pick plans based on statistics and estimates.
  • Execution plan analysis and indexing guidance: interpret EXPLAIN/EXPLAIN ANALYZE outputs and design effective indexes for common query patterns.
  • Cross-model patterns: apply best practices to both relational and NoSQL workloads, including join strategies and cardinality estimation.

Quick Start

Run an EXPLAIN ANALYZE on a representative query to compare plans and identify bottlenecks.

Frequently Asked Questions about nw-query-optimization

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

FAQPage Schema
How do I analyze SQL execution plans to improve query performance?

Analyze SQL execution plans by running EXPLAIN or EXPLAIN ANALYZE to identify bottlenecks and compare cost-based optimizer estimates. This pinpoints missing indexes, poor join strategies, and suboptimal plan selections for relational workloads.

What are the best indexing patterns for NoSQL query optimization?

NoSQL query optimization applies cross-model indexing patterns to match common query structures and cardinality. Selecting effective indexes ensures the database avoids full collection scans and improves fetch performance across NoSQL data models.

How does cost-based optimization select execution plans for database queries?

Cost-based optimization selects execution plans by evaluating table statistics and cardinality estimates to determine the cheapest query path. Understanding these fundamentals explains why optimizers sometimes pick suboptimal plans and guides index selection.

Can I apply relational join strategies to NoSQL workloads?

Cross-model patterns apply relational join strategies and cardinality estimation to NoSQL workloads. Adapting these join algorithms helps tune complex data retrieval across both SQL and NoSQL systems when handling relational-like data structures.

Why does my database query ignore the index and use a sequential scan?

A database query ignores indexes and uses a sequential scan due to outdated statistics, low cardinality estimates, or suboptimal join strategies. Analyzing EXPLAIN ANALYZE outputs reveals the cost-based optimizer's reasoning behind choosing a full scan.