Missing index for guest display name lookup
Open
Nobody has claimed this yet.
bug
performances
- Dominant language
- JavaScript
- Stars
- 61
- Forks
- 34
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 22
Description
https://github.com/nextcloud/guests/blob/ff10aedad8fe3817f3f02994956b4abcd55623e0/lib/UserBackend.php#L220-L234 does builds the query
SELECT
`uid`,
`displayname`
FROM
`oc_guests_users` `u`
LEFT JOIN `oc_preferences` `p` ON (`userid` = `uid`)
AND (`appid` = ?)
AND (`configkey` = ?)
WHERE
(`uid` COLLATE `utf8mb4_general_ci` LIKE ?)
OR (
`displayname` COLLATE `utf8mb4_general_ci` LIKE ?
)
OR (
`configvalue` COLLATE `utf8mb4_general_ci` LIKE ?
)
ORDER BY
`uid_lower` ASC
LIMIT
?
that does not use any index.
Query hash is d9703f573d96020de3765fcd7a85e628
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
Read lib/UserBackend.php around lines 220-234 and inspect the query identified by hash d9703f573d96020de3765fcd7a85e628. Check its query plan to determine why no index is used and identify the required database change. Done means the guest display-name lookup uses an index without changing the intended results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sql
- Domain
- backend, databases, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100