Skip to content

slow SQL queries "INSERT INTO option ... ON DUPLICATE KEY UPDATE" in some rare cases #12400

@mattab

Description

@mattab

Creating this issue to document a rare occurence of slow yet often-executed queries, so far experience on the option table only. Our option table usually contains a couple thousands records at most and is therefore very small. Queries on the table take only a few milliseconds. But in some cases they take like 1 min to run, and we couldn't explain it.

Example 1: this query was running for 50 seconds+:

INSERT INTO `option` (option_name, option_value, autoload) VALUES ('version_xyz', '3.0.2', '1') ON DUPLICATE KEY UPDATE option_value = '3.0.2'

Example 2: this other query was running for many seconds as well:

INSERT INTO `option` (option_name, option_value, autoload) VALUES ('LastFullArchivingStartTime', '1514894465', '0') ON DUPLICATE KEY UPDATE option_value = '1514894465'

If anyone has any idea why these queries could be so slow, please leave a comment!

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: PerformanceFor when we could improve the performance / speed of Matomo.not-in-changelogFor issues or pull requests that should not be included in our release changelog on matomo.org.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions