vendic / magento2-clean-cron-schedule

Magento 2.2 存在 `cron_schedule` 大表问题。当表变大时,定时任务运行时间会增加,导致CPU使用率过高。

安装次数: 8,464

依赖者: 0

建议者: 0

安全: 0

星标: 8

关注者: 4

分支: 7

开放问题: 1

类型:magento2-module

1.0.8 2024-04-19 08:09 UTC

This package is auto-updated.

Last update: 2024-09-19 09:02:22 UTC


README

Magento 2.2 存在 `cron_schedule` 大表问题。当表变大时,定时任务运行时间会增加,导致CPU使用率过高。

识别问题

在我们的一家店铺中,`cron_schedule` 表超过了 1,000,000 行。要识别问题,请运行以下 SQL 查询

SELECT count(*) FROM `cron_schedule`

解决问题

移除 cron schedule 中的旧行

DELETE FROM cron_schedule WHERE  scheduled_at < Date_sub(Now(), interval 24 hour);

来源

此模块将每天执行清理查询一次。

安装

composer require vendic/magento2-clean-cron-schedule

相关问题

关于 Vendic

Vendic - Magento 2 使用 Magento 2 开发技术挑战性的电子商务网站。欢迎查看我们网站上的项目。