Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-27629

Performance problems due to incorrect table statistics after database imports

Details

    Description

      We are seeing big performance problems for databases that were dumped (mysqldump) and then restored in an empty database. The query plans are sometimes completely inefficient and the 'ANALYZE FORMAT = JSON' list a low number of rows in some tables while there are for example 100k rows present ("rows": 1, "r_rows": 99924). This results in complete table scans and queries that normally take ~10ms, now take over 100s to complete.

      Doing an analyze table for all tables in the database (or the ones used in the query) fixes the problem. We are now implementing a cron job that does (mariadb-check --analyze --all-databases) every evening, but that is not an ideal situation.

      I think the problem is that the innodb_table_stats table statistics are not (correctly) updated during the bulk insert of sql data.

      We did not have this problem (or at least did not notice it) in MariaDB 10.4.

      Attachments

        Issue Links

          Activity

            Could this be the same issue as MDEV-27805? That regression was introduced in MariaDB 10.6.5 due to MDEV-25919. A race condition could cause InnoDB to skip the persistent statistics recalculation.

            marko Marko Mäkelä added a comment - Could this be the same issue as MDEV-27805 ? That regression was introduced in MariaDB 10.6.5 due to MDEV-25919 . A race condition could cause InnoDB to skip the persistent statistics recalculation.
            stijn Stijn added a comment -

            @Marko, that seems to be a very similar bug. Hopefully that fix will also fix this issue.

            stijn Stijn added a comment - @Marko, that seems to be a very similar bug. Hopefully that fix will also fix this issue.

            Is there anything known about when 10.6.8 will be released? We're still running analyze table on 10~ dbs/week due to load skyrocketing when this bug occurs. Would love to no longer have to do this.

            nielsh Niels Hendriks added a comment - Is there anything known about when 10.6.8 will be released? We're still running analyze table on 10~ dbs/week due to load skyrocketing when this bug occurs. Would love to no longer have to do this.

            Any update on this? Perhaps as a workaround we can downgrade all our servers to 10.6.4? I believe this is not affected, correct?
            It's a big undertaking but if release is still a long time off perhaps best solution for us.

            nielsh Niels Hendriks added a comment - Any update on this? Perhaps as a workaround we can downgrade all our servers to 10.6.4? I believe this is not affected, correct? It's a big undertaking but if release is still a long time off perhaps best solution for us.

            Is there anything known about when 10.6.8 will be released

            The release is currently planned for 2022-04-29, you can find the schedule at the JIRA dashboard.

            elenst Elena Stepanova added a comment - Is there anything known about when 10.6.8 will be released The release is currently planned for 2022-04-29, you can find the schedule at the JIRA dashboard.

            People

              marko Marko Mäkelä
              stijn Stijn
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.