nextcloud / nextcloud/activity

Expiration background job for activities is not using an index

Open
#647 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop backport-request bug feature: api feature: stream Performance 🚀
Dominant language
JavaScript
Stars
145
Forks
72
Avg merge
6d 9h
Merged PRs (30d)
42

Description

The query is quite heavy and there is no index on the timestamp column alone, so the delete is not using any index and therefor takes quite some time:


MariaDB [oc]> EXPLAIN DELETE FROM `oc_activity` WHERE `timestamp` < 1234567 
    -> ;
+------+-------------+-------------+------+---------------+------+---------+------+---------+-------------+
| id   | select_type | table       | type | possible_keys | key  | key_len | ref  | rows    | Extra       |
+------+-------------+-------------+------+---------------+------+---------+------+---------+-------------+
|    1 | SIMPLE      | oc_activity | ALL  | NULL          | NULL | NULL    | NULL | 6673188 | Using where |
+------+-------------+-------------+------+---------------+------+---------+------+---------+-------------+


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the expiration background job for activities and the schema or migration that defines oc_activity. Reproduce the MariaDB EXPLAIN DELETE query from the issue, then verify that the timestamp-only deletion uses an index and that the related database tests or checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.