1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00
Files
mariadb/sql
Daniel Black d2fa5f8cfc MDEV-8553: Impossible where for a!=a, a<a, a>a
For a table column `a`, the above expressions logically
equate to false in all cases.

With this patch the optimizer knows about this and queries
like:

SELECT * FROM t1 WHERE a!=a

no longer need to evaluate a!=a for every row.

The same applies if the expression was `a<a`, or `a>a`

An `EXPLAIN SELECT COOUNT(*) FROM t1 WHERE a<a` will show:

id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1      SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Impossible WHERE

Similarly `NOT (a!=a)` is always true.

EXPLAIN SELECT COUNT(*) FROM t1 WHERE not (a!=a);
id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1      SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Select tables optimized away
2019-05-10 14:05:36 +04:00
..
2019-04-12 12:45:06 +03:00
2018-12-12 23:16:40 +02:00
2018-09-10 16:47:44 +04:00
2019-04-03 16:47:26 +04:00
2019-04-03 16:47:26 +04:00
2019-03-17 13:06:41 +01:00
2019-03-17 13:06:41 +01:00
2019-01-23 15:30:00 +04:00
2018-11-06 16:24:16 +02:00
2018-04-20 18:29:18 +04:00
2019-04-25 09:05:52 +03:00
2018-09-28 16:37:06 +02:00
2019-04-03 17:43:12 +04:00
2019-04-02 11:04:54 +03:00
2019-05-05 10:23:14 +03:00
2019-03-09 20:22:24 +04:00
2018-08-07 10:48:42 +04:00
2019-01-23 15:30:00 +04:00
2019-04-25 16:05:20 +03:00
2019-04-25 09:04:09 +03:00
2019-03-20 10:41:32 +02:00
2018-09-28 16:37:06 +02:00
2019-03-22 13:20:44 +02:00
2019-03-22 13:20:44 +02:00
2019-05-05 10:23:14 +03:00
2019-05-05 10:23:14 +03:00
2019-05-05 15:06:44 +03:00
2019-04-02 11:04:54 +03:00
2019-05-05 15:06:44 +03:00
2019-05-05 15:06:44 +03:00
2019-02-21 15:04:03 +01:00
2019-05-06 14:56:31 +03:00
2018-11-06 09:40:39 +02:00
2019-02-19 17:41:13 +02:00
2019-05-05 10:23:14 +03:00
2019-02-21 14:40:52 +01:00
2019-03-17 13:06:41 +01:00
2019-05-05 15:06:44 +03:00
2019-01-23 15:30:00 +04:00
2019-03-20 10:41:32 +02:00
2018-05-29 17:34:49 +03:00
2019-05-05 15:06:44 +03:00
2018-08-03 15:57:23 +03:00
2018-08-28 12:22:56 +03:00
2018-12-12 14:09:48 +02:00
2018-04-24 20:59:57 +03:00
2018-04-24 12:48:27 +03:00
2019-03-14 16:33:17 +01:00
2019-03-06 17:06:09 +04:00
2019-02-14 15:23:23 -08:00
2019-01-23 15:30:00 +04:00
2019-02-19 17:41:13 +02:00
2018-10-17 19:37:05 +03:00
2019-05-05 15:06:44 +03:00
2019-05-04 12:43:29 +04:00
2019-05-05 15:06:44 +03:00
2019-05-05 15:06:44 +03:00
2019-05-02 21:43:24 +03:00
2019-03-09 20:22:24 +04:00
2018-04-10 13:12:36 +02:00
2018-04-10 13:12:36 +02:00
2019-04-25 16:05:20 +03:00
2018-11-19 20:22:33 +02:00
2019-03-29 19:41:41 +01:00
2019-05-05 15:06:44 +03:00
2019-03-17 13:06:41 +01:00
2019-03-17 13:06:41 +01:00
2019-04-02 12:00:04 +03:00
2019-03-20 10:41:32 +02:00
2019-03-17 13:06:41 +01:00
2019-03-20 10:41:32 +02:00
2019-03-17 13:06:41 +01:00
2019-05-02 21:43:24 +03:00
2019-02-21 14:40:52 +01:00
2019-05-05 15:06:44 +03:00
2019-05-05 15:06:44 +03:00
2019-03-20 10:41:32 +02:00
2019-03-20 10:41:32 +02:00
2019-04-08 08:22:34 +03:00
2018-10-05 08:09:49 +03:00
2019-01-03 13:09:41 +01:00
2018-11-06 09:40:39 +02:00
2019-03-20 10:41:32 +02:00
2019-05-05 10:23:14 +03:00
2019-05-05 15:06:44 +03:00
2019-05-05 15:06:44 +03:00
2018-04-29 17:53:21 +03:00
2018-02-15 10:22:03 +02:00
2019-05-05 10:23:14 +03:00
2019-05-05 10:23:14 +03:00
2019-02-12 23:07:51 +04:00
2019-03-20 10:41:32 +02:00
2019-04-02 11:04:54 +03:00
2018-09-28 16:37:06 +02:00
2019-05-05 15:06:44 +03:00
2019-05-03 16:46:11 +04:00
2019-03-20 10:41:32 +02:00
2018-05-29 17:34:49 +03:00
2019-03-06 17:06:09 +04:00
2019-04-17 15:59:30 +03:00
2019-05-05 15:06:44 +03:00
2018-04-10 13:12:36 +02:00
2019-04-03 19:46:34 +03:00
2018-11-20 15:05:58 +01:00
2019-04-25 16:05:20 +03:00
2018-12-12 14:09:48 +02:00
2019-04-25 16:05:20 +03:00
2019-04-08 22:00:07 +03:00
2019-02-21 14:57:10 +01:00
2019-02-13 11:52:36 +05:30
2019-02-19 17:41:13 +02:00
2018-12-18 11:33:53 +02:00
2019-03-20 10:41:32 +02:00
2019-05-02 21:43:24 +03:00
2019-01-23 15:30:00 +04:00
2019-03-20 10:41:32 +02:00
2019-01-14 09:40:12 +02:00
2019-05-05 15:06:44 +03:00
2019-05-05 15:06:44 +03:00
2019-05-05 10:23:14 +03:00
2019-03-22 22:57:16 +04:00
2019-04-16 08:57:24 +02:00
2019-04-25 09:05:52 +03:00
2018-11-06 09:40:39 +02:00
2019-05-05 15:06:44 +03:00
2019-05-05 15:06:44 +03:00
2019-03-25 17:18:15 +02:00
2019-05-05 15:06:44 +03:00
2019-03-17 13:06:41 +01:00
2018-04-24 12:48:27 +03:00
2019-04-03 17:43:12 +04:00
2019-03-25 17:18:15 +02:00
2019-03-29 19:41:41 +01:00
2019-01-23 15:30:00 +04:00
2019-03-22 13:20:44 +02:00
2019-01-23 15:30:00 +04:00
2019-01-23 15:30:00 +04:00
2019-01-23 15:30:00 +04:00
2019-01-23 15:30:00 +04:00
2019-04-03 10:56:55 +03:00
2019-01-23 15:30:00 +04:00
2019-05-05 15:06:44 +03:00
2019-01-23 15:30:00 +04:00
2019-04-03 19:46:34 +03:00
2019-01-23 15:30:00 +04:00
2019-01-23 15:30:00 +04:00
2019-03-28 12:39:50 +02:00
2019-03-28 12:39:50 +02:00
2019-01-23 15:30:00 +04:00
2019-01-23 15:30:00 +04:00
2019-02-02 11:40:02 +02:00
2019-02-13 18:47:27 +01:00
2019-02-04 15:12:14 +02:00
2019-04-25 15:06:40 +04:00
2019-04-25 15:06:40 +04:00