Issue Description
When a client calls Email/query, Stalwart loads all message metadata (sort fields such as receivedAt, size, subject, etc.) for the entire account into memory before applying sort and pagination. On large mailboxes (e.g. 100k+ messages), this results in significant memory pressure, high latency, and excessive internal data transfer — even when the client only needs the first page of 50 results.
Expected Behavior
For SQL-backed deployments, push the sort and pagination down to the database
Stalwart Version
v0.16.x
Installation Method
Docker
Database Backend
FoundationDB
Blob Storage
S3-compatible
Search Engine
Elasticsearch
Directory Backend
Internal
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on