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

LP:954439 - Painfully Slow Query on MariaDB 5.3.5 - Inner Join

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Resolution: Incomplete
    • None
    • None
    • None

    Description

      You can use the data files from https://bugs.launchpad.net/maria/+bug/938977 to reproduce this.

      Mysql 5.1.49 and MySQL 5.1.61
      Handle this query in 5 seconds on my EC2 m2.4xlarge instance.

      I was getting ready to move to MariaDB on production.
      Installed mariadb 5.3.5, ran this query, waited 3+ minutes, and it still didn't complete, so had to revert back to mysql 5.1

      SELECT `data_mediagallery`.`filetype` AS `filetype`, `data_mediagallery`.`id` AS `id`, `data_mediagallery`.`metadata` AS `metadata`, `data_mediagallery`.`title` AS `title`, `data_mediagallery`.`vhost` AS `vhost` FROM data_mediagallery
      INNER JOIN
      `geo` USE INDEX ( `morton` )
      ON
      `data_mediagallery`.`id` = `geo`.`foreignid`
      AND
      `geo`.`datatype` = 1
      AND
      `geo`.`morton` BETWEEN getGeoMorton( -89.055209, -173.81254 ) AND getGeoMorton( 89.505209, 173.36254 )
      AND
      `geo`.`latitude` BETWEEN -89.055209 AND 89.505209
      AND
      `geo`.`longitude` BETWEEN -173.81254 AND 173.36254

      AND
      `geo`.`vhost` = 123
      WHERE (data_mediagallery.context = 1) AND (data_mediagallery.hidden = 0) AND (data_mediagallery.status IN (3)) AND (data_mediagallery.vhost = 123) ORDER BY `data_mediagallery`.`upload` DESC LIMIT 1000, 500;

      It's very similar to the query in the previous bug.

      The geoMorton function is available there also.

      Attachments

        Activity

          People

            Unassigned Unassigned
            davefm DaveFM (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 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.