Optimize step query
Open
@benjaminfrueh is already working on this.
Since Nov 5, 2025.
bug
performance 🚀
- Dominant language
- JavaScript
- Stars
- 659
- Forks
- 133
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 110
Description
https://github.com/nextcloud/text/blob/main/lib/Db/StepMapper.php#L23-L36
- We may not need the version check anymore as we use the id of the step as a version these days
- We could make use of a combined
Example explain of a document with 4k steps
MariaDB [oc]> EXPLAIN FORMAT=JSON select * from oc_text_steps where document_id = 11824370 and version > 1;
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| EXPLAIN |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {
"query_block": {
"select_id": 1,
"nested_loop": [
{
"table": {
"table_name": "oc_text_steps",
"access_type": "ref",
"possible_keys": ["rd_steps_did_idx", "rd_steps_version_idx"],
"key": "rd_steps_did_idx",
"key_length": "8",
"used_key_parts": ["document_id"],
"ref": ["const"],
"rows": 4084,
"filtered": 50,
"attached_condition": "oc_text_steps.version > 1"
}
}
]
}
} |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.006 sec)
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.
Assessment
This issue has not been assessed yet.