Missing indexes in appconfig and flow_operations
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Steps to reproduce
set log_queries_not_using_indexes = 1 to mysql config.
Expected behaviour
Probably a very few logfile entrys from upgrades etc.
Actual behaviour
# Time: 2021-01-26T23:45:57.678222Z
# User@Host: owncloud[owncloud] @ localhost [] Id: 2
# Schema: owncloud Last_errno: 0 Killed: 0
# Query_time: 0.011853 Lock_time: 0.011542 Rows_sent: 268 Rows_examined: 268 Rows_affected: 0
# Bytes_sent: 10121
use owncloud;
SET timestamp=1611704757;
SELECT * FROM `oc_appconfig`;
# Time: 2021-01-26T23:45:58.073818Z
# User@Host: owncloud[owncloud] @ localhost [] Id: 2
# Schema: owncloud Last_errno: 0 Killed: 0
# Query_time: 0.011857 Lock_time: 0.011599 Rows_sent: 0 Rows_examined: 0 Rows_affected: 0
# Bytes_sent: 267
SET timestamp=1611704758;
SELECT `class`, `entity`, `events` FROM `oc_flow_operations` WHERE `events` <> '[]' GROUP BY `class`, `entity`, `events`;
# Time: 2021-01-26T23:45:58.456739Z
# User@Host: owncloud[owncloud] @ localhost [] Id: 3
# Schema: owncloud Last_errno: 0 Killed: 0
# Query_time: 0.000376 Lock_time: 0.000090 Rows_sent: 268 Rows_examined: 268 Rows_affected: 0
# Bytes_sent: 10121
SET timestamp=1611704758;
SELECT * FROM `oc_appconfig`;
# Time: 2021-01-26T23:45:58.470741Z
# User@Host: owncloud[owncloud] @ localhost [] Id: 3
# Schema: owncloud Last_errno: 0 Killed: 0
# Query_time: 0.000346 Lock_time: 0.000073 Rows_sent: 0 Rows_examined: 0 Rows_affected: 0
# Bytes_sent: 267
SET timestamp=1611704758;
SELECT `class`, `entity`, `events` FROM `oc_flow_operations` WHERE `events` <> '[]' GROUP BY `class`, `entity`, `events`;
# Time: 2021-01-26T23:46:00.565861Z
# User@Host: owncloud[owncloud] @ localhost [] Id: 4
# Schema: owncloud Last_errno: 0 Killed: 0
# Query_time: 0.000383 Lock_time: 0.000103 Rows_sent: 268 Rows_examined: 268 Rows_affected: 0
# Bytes_sent: 10121
SET timestamp=1611704760;
SELECT * FROM `oc_appconfig`;
# Time: 2021-01-26T23:46:00.584120Z
# User@Host: owncloud[owncloud] @ localhost [] Id: 4
# Schema: owncloud Last_errno: 0 Killed: 0
# Query_time: 0.000318 Lock_time: 0.000074 Rows_sent: 0 Rows_examined: 0 Rows_affected: 0
# Bytes_sent: 267
SET timestamp=1611704760;
SELECT `class`, `entity`, `events` FROM `oc_flow_operations` WHERE `events` <> '[]' GROUP BY `class`, `entity`, `events`;
Nextcloud version: (see Nextcloud admin page)
20.0.6
Updated from an older Nextcloud/ownCloud or fresh install:
Originally Owncloud, several major Nextcloud versions upgraded
Signing status:
No errors have been found.
List of activated apps:
IMHO if the same querys happen that often (should roughly be 1 request per second being logged) there should be an Index.
Regards!
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
No source file or test is named. Start with the logged SELECT statements against oc_appconfig and oc_flow_operations, then locate the corresponding database schema definitions or migrations. Done means determining whether appropriate indexes address the reported unindexed queries without changing the query results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100