High memory consumption when getting address book cards
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Filing here as an issue to collect findings, I'm not entirely sure if that is something we really can solve properly e.g. by streaming the individual card data rather than keeping them all in memory.
There seems to be at least some additional overhead from https://github.com/nextcloud/server/pull/19901 but the major impact is the database result that is loaded.

Some useful queries:
select id, sum(char_length(carddata)) from oc_cards where addressbookid = 7;
select id, char_length(carddata) as size from oc_cards where addressbookid = 7 order by size;
select substring_index(carddata, '\n', 10) from oc_cards where id = 3296;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at CardDavBackend::getCards and use the linked Blackfire profile to inspect memory usage, then review the provided queries against oc_cards and carddata. Done would require a clearly demonstrated reduction in memory consumed while retrieving address book cards, with the existing card data still available to callers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sql
- Domain
- backend, databases, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100