Skip to content

Add SQL slow query logging and automatic EXPLAIN ANALYZE#934

Open
aliyudotdev wants to merge 1 commit into
rinafcode:mainfrom
aliyudotdev:feat/884-slow-query-logging
Open

Add SQL slow query logging and automatic EXPLAIN ANALYZE#934
aliyudotdev wants to merge 1 commit into
rinafcode:mainfrom
aliyudotdev:feat/884-slow-query-logging

Conversation

@aliyudotdev

Copy link
Copy Markdown

Closes #884

  • Adds SlowQueryLogger implementing TypeORM's Logger interface
  • Logs queries over DB_SLOW_QUERY_THRESHOLD_MS (default 500ms) with query text, params, and duration as structured JSON
  • For queries over DB_EXPLAIN_THRESHOLD_MS (default 2000ms), runs EXPLAIN ANALYZE asynchronously (SELECT-only, to avoid re-executing mutating statements) and logs the plan
  • Registered via getDatabaseConfig(); disabled when NODE_ENV=test

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@aliyudotdev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Great work on this PR
I really appreciate the effort you put into this—everything
kindly fix your workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SQL slow query logging and automatic EXPLAIN ANALYZE for queries exceeding threshold

2 participants