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

5.5 is slower than 5.3 because of many str_to_datetime calls

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.5.30
    • Fix Version/s: 5.5.31
    • Component/s: None
    • Labels:
      None

      Description

      5.5 is slower than 5.3 on a DBT-3 query#1, MyISAM storage engine.
      Profiling shows that 5.5 does many str_to_datetime calls.

      The query:

      select
              l_returnflag,
              l_linestatus,
              sum(l_quantity) as sum_qty,
              sum(l_extendedprice) as sum_base_price,
              sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
              sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
              avg(l_quantity) as avg_qty,
              avg(l_extendedprice) as avg_price,
              avg(l_discount) as avg_disc,
              count(*) as count_order
      from
              lineitem
      where
              l_shipdate <= date_sub('1998-12-01', interval 79 day)
      group by
              l_returnflag,
              l_linestatus
      order by
              l_returnflag,
              l_linestatus;
      

      See comments to MDEV-4150 for analysis. MySQL-5.5's "constant item caching" interferes with get_datetime_value()'s caching mechanism, as a result, datetime value is cached in its string form, and we get string->datetime conversion done for every row.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            psergey Sergei Petrunia added a comment -

            Small dataset for debugging. Performance difference can be observed on a big dataset.

            Show
            psergey Sergei Petrunia added a comment - Small dataset for debugging. Performance difference can be observed on a big dataset.

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                psergey Sergei Petrunia
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h