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

Make optimizer handle LCASE(varchar_col)=...

Details

    Description

      extend MDEV-31496 to handle LCASE()

      Attachments

        Issue Links

          Activity

            oleg.smirnov Oleg Smirnov added a comment -

            The attached lcase-discrepancies.sql shows characters for which the condition

            (t1.a=t2.a) = (LCASE(t1.a)=LCASE(t2.a))

            is not fulfilled. That means it is not possible to remove LCASE() for strings containing those characters.

            oleg.smirnov Oleg Smirnov added a comment - The attached lcase-discrepancies.sql shows characters for which the condition (t1.a=t2.a) = (LCASE(t1.a)=LCASE(t2.a)) is not fulfilled. That means it is not possible to remove LCASE() for strings containing those characters.
            oleg.smirnov Oleg Smirnov added a comment - - edited

            bar suggested looking into the UCA 1400 collation. The attached script uca_1400_ucase.sql shows there are discrepancies in UCASE() comparisons while there are none for LCASE().
            Since there are no discrepancies for LCASE(), it is possible to implement the optimization for columns having the uca_1400_ai_ci collation.

            Another suggestion is having a constraint

            CHECK(a=LCASE(a))

            on the target column. The optimizer might check if there is such a constraint and apply the optimization. So the users willing this optimization applied must first add the constraints for target columns.

            oleg.smirnov Oleg Smirnov added a comment - - edited bar suggested looking into the UCA 1400 collation. The attached script uca_1400_ucase.sql shows there are discrepancies in UCASE() comparisons while there are none for LCASE(). Since there are no discrepancies for LCASE(), it is possible to implement the optimization for columns having the uca_1400_ai_ci collation. Another suggestion is having a constraint CHECK(a=LCASE(a)) on the target column. The optimizer might check if there is such a constraint and apply the optimization. So the users willing this optimization applied must first add the constraints for target columns.
            oleg.smirnov Oleg Smirnov added a comment -

            One more complication: it is not enough for UCA 1400 to run one-character checks as they are in the script. Two- or three-character combinations may produce different weights for a single character depending on its position, so additional checks are required.

            oleg.smirnov Oleg Smirnov added a comment - One more complication: it is not enough for UCA 1400 to run one-character checks as they are in the script. Two- or three-character combinations may produce different weights for a single character depending on its position, so additional checks are required.

            People

              oleg.smirnov Oleg Smirnov
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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