chore: add query result streaming for large result sets #31

Open
opened 2026-02-21 01:03:18 +00:00 by Clotho · 0 comments
Member

Summary

The QueryExecutionService currently loads all results into memory before returning them. For large result sets this can cause memory exhaustion.

Problem

  • $query->get() loads entire result set into PHP memory
  • Tier limits partially mitigate this, but memory pressure still exists at high tiers
  • No cursor-based pagination for large results

Proposed Solution

  • Implement cursor-based streaming using Laravel's cursor() method
  • Add chunked JSON streaming response
  • Return paginated metadata (has_more, next_cursor)
  • Respect tier row limits during streaming

Files

  • src/Mcp/Services/QueryExecutionService.php
  • src/Mcp/Tools/QueryDatabase.php

Notes

Also noted in TODO.md under Performance. Estimated effort: 3-4 hours.

## Summary The `QueryExecutionService` currently loads all results into memory before returning them. For large result sets this can cause memory exhaustion. ## Problem - `$query->get()` loads entire result set into PHP memory - Tier limits partially mitigate this, but memory pressure still exists at high tiers - No cursor-based pagination for large results ## Proposed Solution - Implement cursor-based streaming using Laravel's `cursor()` method - Add chunked JSON streaming response - Return paginated metadata (`has_more`, `next_cursor`) - Respect tier row limits during streaming ## Files - `src/Mcp/Services/QueryExecutionService.php` - `src/Mcp/Tools/QueryDatabase.php` ## Notes Also noted in TODO.md under Performance. Estimated effort: 3-4 hours.
Clotho added the
discovery
label 2026-02-21 01:03:18 +00:00
Snider added the
clotho
label 2026-02-21 01:23:16 +00:00
Charon added the
agent-ready
label 2026-02-21 01:30:09 +00:00
Sign in to join this conversation.
No description provided.