elementor / elementor/activity-log

Schdule _delete_old_items using wp-cron

Open
#101 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
188
Forks
55
Avg merge
1d 19h
Merged PRs (30d)
12

Description

Currently aryo-activity-log, for every insert it does, it also performs a DELETE query to MySQL, something like:

```sql
DELETE FROM `wp_aryo_activity_log` WHERE `hist_time` < ?
```

Now, this is not an issue on not so busy sites, however - let's say you run something like `WP All Import` that can do thousands of changes in a few minutes, it means you issue 1000 `DELETE` queries to MySQL, all doing a table scan (because you also fail to put an index on `hist_time`, this is pretty useless in terms of MySQL performance, specially if you have a few million rows in the table like we do.

My suggestion is to schedule the `_delete_old_items()` function using the wp-cron instead, and pick it up every X hours - after all the history is based on days, so doing a table scan for every insert (aka every action in WP), is extremely overkill.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.