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

Queries optimizer : dates queries with LIKE

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Fix Version/s: 10.2
    • Component/s: None
    • Labels:
      None

      Description

      When I was a young and foolish developer, I used to write queries containing things like this :

      SELECT * FROM table WHERE `mydate` LIKE '2013-02-%'

      which is of course WAAAAAAY slower than

      SELECT * FROM table WHERE `mydate` BETWEEN '2013-02-01' AND '2013-03-01'

      I'm probably not the only one who ever used a LIKE on a date field for querying subsets based on years, months, days, hours...

      It might be interesting to optimize these queries as it should be pretty simple and lead to big performance gains for those who don't really understand what's happening under the hood when the queries they write are executed.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Hi,

            Would you consider implementing the optimization and contributing it as a patch to MariaDB?

            Thanks

            Show
            elenst Elena Stepanova added a comment - Hi, Would you consider implementing the optimization and contributing it as a patch to MariaDB? Thanks

              People

              • Assignee:
                Unassigned
                Reporter:
                Sunjohn Sunjohn
              • Votes:
                5 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: