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

            serg Sergei Golubchik created issue -
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            serg Sergei Golubchik made changes -
            Assignee Sergei Petrunia [ psergey ]
            serg Sergei Golubchik made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            oleg.smirnov Oleg Smirnov made changes -
            Assignee Sergei Petrunia [ psergey ] Oleg Smirnov [ JIRAUSER50405 ]
            oleg.smirnov Oleg Smirnov made changes -
            Attachment lcase-discrepancies.sql [ 71927 ]
            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 made changes -
            Priority Critical [ 2 ] Major [ 3 ]
            oleg.smirnov Oleg Smirnov made changes -
            Attachment uca_1400_ucase.sql [ 71944 ]
            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 made changes -
            Priority Major [ 3 ] Minor [ 4 ]
            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.
            serg Sergei Golubchik made changes -
            Fix Version/s 11.4 [ 29301 ]
            Fix Version/s 11.3 [ 28565 ]
            psergei Sergei Petrunia made changes -
            Labels optimizer-feature
            serg Sergei Golubchik made changes -
            Fix Version/s 11.5 [ 29506 ]
            Fix Version/s 11.4 [ 29301 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.6 [ 29515 ]
            Fix Version/s 11.5 [ 29506 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 11.7 [ 29815 ]
            Fix Version/s 11.6 [ 29515 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.8 [ 29921 ]
            Fix Version/s 11.7 [ 29815 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.8 [ 29921 ]

            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.