Code audit

Database query efficiency

Enji Guard checks how efficiently your app uses its database in key workflows.

  • Repository and branch
  • Read-only

What did the latest database audit find?

Worked 4 s · Enji Guard via MCP  ›

Score 79/100 — healthy. 2 findings:

  • High riskOrder history queries shipments per order
  • Medium riskCatalog editor loads unused image data

Fix them.

Worked 41 s  ›

Done. Both fixed, query counts checked:

  • Order history loads shipments in one query
  • Catalog editor reads only IDs and names

Query counts verified. Ready for review.

What the audit checks

Eight areas, from indexes to bulk writes.

  • Indexes

    Do indexes support filters, joins, and sorting?

  • Filters and joins

    Do filters and joins cause unnecessary work?

  • Related data

    Does each row trigger another query for related data?

  • Repeated reads

    Are repeat reads justified by freshness needs?

  • Data volume

    Are row counts bounded, and are all fields needed?

  • Paging and batch reads

    Are limits, counts, and traversal suited to the task?

  • Sorting and totals

    Where and how much data is sorted or summarized?

  • Writes and bulk operations

    Per-item writes and redundant reads or updates

The audit follows a database read

What a report can find at each step

  1. Workflow

    Trace requests and background jobs to the queries they trigger.

  2. Related data

    See whether rows trigger separate lookups and loads of related data.

  3. Counts

    Compare counts across layers for matching filters and freshness.

  4. Data loading

    Check which rows and fields travel back from the database.

  5. Use of results

    Follow the result to see which layers reuse it or read it again.

What's in the report

  • A 0–100 score
  • Findings with file locations and recommended changes
  • Scope — what was checked and what wasn't

What the audit is not

  • Does not connect to the production database
  • Does not measure load on the production database
  • Does not flag a missing index on its own

Connect a repository

GitHub or GitLab. The audit doesn't change your code.