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

New-style hints: [NO_]DERIVED_CONDITION_PUSHDOWN, [NO_]MERGE

    XMLWordPrintable

Details

    • Hide
      When a query filters results with a WHERE condition, that query may be more efficient when the optimizer pushes all or part of the WHERE condition down into a derived table, if a derived table is indeed present in the query. The DERIVED_CONDITION_PUSHDOWN hint explicitly tells the optimizer to apply this optimization, even if the condition_pushdown_for_derived optimizer switch is off. Conversely, NO_DERIVED_CONDITION_PUSHDOWN lets you turn it off for specific queries.

      Derived tables can sometimes be "merged" into the main query, essentially treating them as if they were part of the original table. This can lead to more efficient execution plans. For example,
      SELECT a+2 FROM (select b*2+1 as a from t1) t;
      will be merged such that the derived table t is removed and the selected columns recombined, resulting in
      SELECT b*2+3 FROM t1;
      The MERGE hint forces this behavior, while NO_MERGE prevents it.
      Show
      When a query filters results with a WHERE condition, that query may be more efficient when the optimizer pushes all or part of the WHERE condition down into a derived table, if a derived table is indeed present in the query. The DERIVED_CONDITION_PUSHDOWN hint explicitly tells the optimizer to apply this optimization, even if the condition_pushdown_for_derived optimizer switch is off. Conversely, NO_DERIVED_CONDITION_PUSHDOWN lets you turn it off for specific queries. Derived tables can sometimes be "merged" into the main query, essentially treating them as if they were part of the original table. This can lead to more efficient execution plans. For example, SELECT a+2 FROM (select b*2+1 as a from t1) t; will be merged such that the derived table t is removed and the selected columns recombined, resulting in SELECT b*2+3 FROM t1; The MERGE hint forces this behavior, while NO_MERGE prevents it.
    • Q2/2025 Development

    Description

      Implement table-level hints:

      MERGE, NO_MERGE 
      DERIVED_CONDITION_PUSHDOWN, NO_DERIVED_CONDITION_PUSHDOWN
      

      in the same way they're done in MySQL 8. See MySQL docs at:
      https://dev.mysql.com/doc/refman/8.4/en/derived-condition-pushdown-optimization.html
      https://dev.mysql.com/doc/refman/8.4/en/optimizer-hints.html#optimizer-hints-table-level

      The logic for enabling the hints is expected to be very basic - hook at the same place where the check for optimizer_switch is, override the optimizer_switch setting.

      The code to base on is MDEV-35504, look at other similar level hints and copy the approach.

      Attachments

        Issue Links

          Activity

            People

              Gosselin Dave Gosselin
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.