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

"WHERE CONTAINS(indexed_geometry_column,1)" causes full table scan

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1(EOL)
    • 10.1.7
    • Optimizer
    • None

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1  (a GEOMETRY NOT NULL, SPATIAL KEY(a)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (Point(1,1)),(Point(2,2)),(Point(3,3));
      EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1);

      returns

      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra       |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
      |    1 | SIMPLE      | t1    | ALL  | a             | NULL | NULL    | NULL |    3 | Using where |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+

      This is wrong. CONTAINS() and other spatial relations should report "Impossible WHERE" on attempt to use non-geometry values. There is no a need to do the full table scan, the result will be empty set anyway.

      Attachments

        Activity

          bar Alexander Barkov created issue -
          bar Alexander Barkov made changes -
          Field Original Value New Value
          Fix Version/s 10.1.7 [ 19604 ]
          Fix Version/s 10.1 [ 16100 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 71026 ] MariaDB v4 [ 149468 ]

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.