Skip to content

[PERFORMANCE]: Optimize SQLite tag filter SQL/bind generation #1833

@crivetimihai

Description

@crivetimihai

Summary

SQLite JSON tag filtering builds SQL text and random bind parameter names per call. This adds CPU overhead in SQLite deployments.

Evidence (current code)

  • mcpgateway/utils/sqlalchemy_modifier.py: SQLite branch in json_contains_expr uses uuid for bind names and builds text(...) per call.

Impact

  • Extra CPU for tag-filtered list endpoints on SQLite.

Proposed fix

  • Use deterministic bind naming by position; cache SQL text templates by len(values) and match_any.

Acceptance criteria

  • SQLite tag filtering avoids random bind names and reuses cached SQL templates.
  • Behavior unchanged for any/all matching.

Metadata

Metadata

Assignees

Labels

COULDP3: Nice-to-have features with minimal impact if left out; included if time permitsperformancePerformance related items

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions