database-performance-debugging by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill database-performance-debugging数据库性能问题直接影响应用程序的响应速度。调试的重点在于识别慢查询并优化执行计划。
最小工作示例:
-- Enable slow query log (MySQL)
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 0.5;
-- View slow queries
SHOW GLOBAL STATUS LIKE 'Slow_queries';
SELECT * FROM mysql.slow_log;
-- PostgreSQL slow queries
CREATE EXTENSION pg_stat_statements;
SELECT mean_exec_time, calls, query
FROM pg_stat_statements
ORDER BY mean_exec_time DESC LIMIT 10;
-- SQL Server slow queries
SELECT TOP 10
execution_count,
total_elapsed_time,
statement_text
FROM sys.dm_exec_query_stats
ORDER BY total_elapsed_time DESC;
-- Query profiling
EXPLAIN ANALYZE
SELECT * FROM orders WHERE user_id = 123;
// ... (see reference guides for full implementation)
references/ 目录下的详细实现:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
每周安装量
130
代码仓库
GitHub 星标数
127
首次出现
2026年1月21日
安全审计
已安装于
opencode109
gemini-cli106
codex103
claude-code101
cursor99
github-copilot91
Database performance issues directly impact application responsiveness. Debugging focuses on identifying slow queries and optimizing execution plans.
Minimal working example:
-- Enable slow query log (MySQL)
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 0.5;
-- View slow queries
SHOW GLOBAL STATUS LIKE 'Slow_queries';
SELECT * FROM mysql.slow_log;
-- PostgreSQL slow queries
CREATE EXTENSION pg_stat_statements;
SELECT mean_exec_time, calls, query
FROM pg_stat_statements
ORDER BY mean_exec_time DESC LIMIT 10;
-- SQL Server slow queries
SELECT TOP 10
execution_count,
total_elapsed_time,
statement_text
FROM sys.dm_exec_query_stats
ORDER BY total_elapsed_time DESC;
-- Query profiling
EXPLAIN ANALYZE
SELECT * FROM orders WHERE user_id = 123;
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Identify Slow Queries | Identify Slow Queries |
| Common Issues & Solutions | Common Issues & Solutions |
| Execution Plan Analysis | Execution Plan Analysis |
| Debugging Process | Debugging Process |
Weekly Installs
130
Repository
GitHub Stars
127
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode109
gemini-cli106
codex103
claude-code101
cursor99
github-copilot91
TanStack Query v5 完全指南:React 数据管理、乐观更新、离线支持
2,500 周安装