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

Queries optimizer : dates queries with LIKE

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Sunjohn Sunjohn
            Votes:
            5 Vote for this issue
            Watchers:
            6 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.