From 3085944b9d129310c41e206624e6fa81b96925d7 Mon Sep 17 00:00:00 2001 From: Peng Tian Date: Wed, 14 Oct 2015 23:35:53 -0700 Subject: [PATCH] [DocStore] Support range optimizations for JOINs for document indexes and more Summary: (1) This diff introduces range optimizations support for JOINs for document indexes. (2) This diff also introduces a change that a new document will be created and the document path will be built for a null column for partial update if argument CHECK_EXISTS is not specified, i.e., the argument is CHECK_NONE or CHECK_NOTEXISTS. Before this diff, a null column doesn't support partial update. (3) This diff also fixes some issues with document keys with string type. Before this diff, the raw key data (with an extra byte for null) is store in InnoDB b-tree indexes. Now a 2-byte key length is stored before the key data (after the byte for null). Please note that document columns and their keys are always nullable. For example, a key "abc" will be stored as 6 bytes: 0x00 0x03 0x00 0x61 0x62 0x63, in which: the 1st byte indicates that this key is not null, the 2nd and 3rd bytes are the key length 3 in little endian format, the rest 3 bytes are the key data "abc". In InnoDB, the index type for string document keys now is DATA_BLOB instead of DATA_BINARY, also in MySQL, Field_varstring instead of Field_string instances will be created for string document keys so that the 2-byte length can be added. Examples of query plans with document indexes: Covering indexes: explain extended select a1 from t1 use document keys where doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range doc11_int doc11_int 9 NULL 7 100.00 Using where; Using index Non-covering indexes: explain extended select doc11.string, doc11.int from t1 use document keys where doc11.string >= 'kkk'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range doc11_string doc11_string 103 NULL 1 100.00 Using where Covering indexes: explain extended select a1, doc11.int from t1 use document keys where doc11.int between 5 and 9; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range doc11_int doc11_int 9 NULL 5 100.00 Using where; Using index Covering indexes: explain extended select a1, doc11.int from t1 use document keys where doc11.int not in (5, 7, 9, 12); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range doc11_int doc11_int 9 NULL 7 100.00 Using where; Using index Covering indexes: explain extended select t1.doc11.double, t2.doc21.double from t1 use document keys, t2 use document keys where t1.doc11.double > t2.doc21.double and t2.doc21.double > 10.1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range doc21_double doc21_double 9 NULL 2 100.00 Using where; Using index 1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x10) Covering indexes: explain extended select t1.doc11.int, t2.doc21.int from t1 use document keys, t2 use document keys where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range doc21_int doc21_int 9 NULL 3 100.00 Using where; Using index 1 SIMPLE t1 range doc11_int doc11_int 9 NULL 6 100.00 Using where; Using index; Using join buffer (Block Nested Loop) Non-covering indexes: explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string from t1 use document keys, t2 use document keys where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range doc21_int doc21_int 9 NULL 3 100.00 Using where 1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 50.00 Using where; Using join buffer (Block Nested Loop) Covering indexes: explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int from t1 use document keys, t2 use document keys, t3 use document keys where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index doc11_int doc11_int 9 NULL 12 100.00 Using where; Using index 1 SIMPLE t2 ref doc21_int doc21_int 9 test.t1.`doc11`.`int` 1 100.00 Using index 1 SIMPLE t3 ref doc31_int doc31_int 9 test.t1.`doc11`.`int` 1 100.00 Using index Covering indexes: explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int from t1 use document keys, t2 use document keys, t3 use document keys where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 range doc31_int doc31_int 9 NULL 2 100.00 Using where; Using index 1 SIMPLE t1 index doc11_int doc11_int 9 NULL 12 100.00 Using index; Using join buffer (Block Nested Loop) 1 SIMPLE t2 ALL doc21_int NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x8) Covering indexes: explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int from t1 use document keys, t2 use document keys, t3 use document keys where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and (t3.doc31.int between 6 and 10) and (t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range doc21_int doc21_int 9 NULL 3 100.00 Using where; Using index 1 SIMPLE t3 range doc31_int doc31_int 9 NULL 5 100.00 Using where; Using index; Using join buffer (Block Nested Loop) 1 SIMPLE t1 range doc11_int doc11_int 9 NULL 6 100.00 Using where; Using index; Using join buffer (Block Nested Loop) Non-covering indexes: explain extended select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double from t1 use document keys, t2 use document keys, t3 use document keys where (t1.doc11.double between 3.3 and 8.8) and (t2.doc21.double between 7.7 and 9.9) and (t3.doc31.double between 6.6 and 10.1) and (t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range doc21_double doc21_double 9 NULL 3 100.00 Using where 1 SIMPLE t3 ALL doc31_double NULL NULL NULL 12 41.67 Using where; Using join buffer (Block Nested Loop) 1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 50.00 Using where; Using join buffer (Block Nested Loop) Test Plan: MTR Reviewers: tianx Reviewed By: tianx Subscribers: webscalesql-eng Differential Revision: https://reviews.facebook.net/D50757 Differential Revision: https://reviews.facebook.net/D52497 --- .../r/type_document_path_optimizer.result | 5256 ++++++++++++----- .../type_document_path_partial_update.result | 4 +- .../json/t/type_document_path_optimizer.test | 2099 +++++-- sql/field.cc | 229 +- sql/field.h | 135 +- sql/key.cc | 8 +- sql/opt_range.cc | 12 +- sql/sql_tmp_table.cc | 12 +- sql/table.cc | 32 +- storage/innobase/dict/dict0dict.cc | 5 +- storage/innobase/row/row0sel.cc | 4 +- 11 files changed, 5858 insertions(+), 1938 deletions(-) diff --git a/mysql-test/suite/json/r/type_document_path_optimizer.result b/mysql-test/suite/json/r/type_document_path_optimizer.result index 9d639065e4c8..93bfbaef9451 100644 --- a/mysql-test/suite/json/r/type_document_path_optimizer.result +++ b/mysql-test/suite/json/r/type_document_path_optimizer.result @@ -3,212 +3,620 @@ Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection master] -drop table if exists t1, t2, t3, t4; +drop table if exists t1, t2, t3; create table t1 ( -a int primary key, -b int, -c double, -d char(100), -doc1 document, -doc2 document, +a1 int primary key, +b1 int, +c1 double, +d1 char(10), +doc11 document, +doc12 document default null, # regular keys -key b_a (b, a), +key b1_a1 (b1, a1), # single column keys -key doc1_bool (doc1.bool as bool), -key doc1_int (doc1.int as int), -key doc1_double (doc1.double as double), -key doc1_string (doc1.string as string(100)), -key doc1_nested (doc1.k1.k2.k3.int as int), -key doc2_int (doc2.int as int), -key doc2_double (doc2.double as double), +key doc11_bool (doc11.bool as bool), +key doc11_int (doc11.int as int), +key doc11_double (doc11.double as double), +key doc11_string (doc11.string as string(3)), +key doc11_nested (doc11.k1.k2.k3.int as int), +key doc12_int (doc12.int as int), +key doc12_double (doc12.double as double), # multi-column keys -key doc1_b (doc1.int as int, b), -key doc1_c (doc1.double as double, c), -key doc1_d (doc1.int as int, d), -key b_doc1 (b, doc1.int as int) +key doc11_b1 (doc11.int as int, b1), +key doc11_c1 (doc11.double as double, c1), +key doc11_d1 (doc11.int as int, d1), +key b1_doc11 (b1, doc11.int as int) +) engine = innodb; +create table t2 ( +a2 int primary key, +b2 int, +c2 double, +d2 char(10), +doc21 document, +doc22 document, +# regular keys +key b2_a2 (b2, a2), +# single column keys +key doc21_bool (doc21.bool as bool), +key doc21_int (doc21.int as int), +key doc21_double (doc21.double as double), +key doc21_string (doc21.string as string(2)), +key doc21_nested (doc21.k1.k2.k3.int as int), +key doc22_int (doc22.int as int), +key doc22_double (doc22.double as double), +# multi-column keys +key doc21_b2 (doc21.int as int, b2), +key doc21_c2 (doc21.double as double, c2), +key doc21_d2 (doc21.int as int, d2), +key b2_doc21 (b2, doc21.int as int) +) engine = innodb; +create table t3 ( +a3 int primary key, +b3 int, +c3 double, +d3 char(10), +doc31 document, +doc32 document, +# regular keys +key b3_a3 (b3, a3), +# single column keys +key doc31_bool (doc31.bool as bool), +key doc31_int (doc31.int as int), +key doc31_double (doc31.double as double), +key doc31_string (doc31.string as string(3)), +key doc31_nested (doc31.k1.k2.k3.int as int), +key doc32_int (doc32.int as int), +key doc32_double (doc32.double as double), +# multi-column keys +key doc31_b3 (doc31.int as int, b3), +key doc31_c3 (doc31.double as double, c3), +key doc31_d3 (doc31.int as int, d3), +key b3_doc31 (b3, doc31.int as int) ) engine = innodb; insert into t1 values -(10, 10, 10.1, 'jjj', '{"bool":false, "int":10, "double":10.1, "string":"jjj", "k1":{"k2":{"k3":{"int":10}}}, "id":10}', '{"int":10, "double":10.1}'), -(11, 11, 11.11, 'kkk', '{"bool":false, "int":11, "double":11.11, "string":"kkk", "k1":{"k2":{"k3":{"int":11}}}, "id":11}', '{"int":11, "double":11.11}'), -(12, 12, 12.12, 'lll', '{"bool":false, "int":12, "double":12.12, "string":"lll", "k1":{"k2":{"k3":{"int":12}}}, "id":12}', '{"int":12, "double":12.12}'), -(1, 1, 1.1, 'aaa', '{"bool":true, "int":1, "double":1.1, "string":"aaa", "k1":{"k2":{"k3":{"int":1}}}, "id":1}', '{"int":1, "double":1.1}'), -(2, 2, 2.2, 'bbb', '{"bool":true, "int":2, "double":2.2, "string":"bbb", "k1":{"k2":{"k3":{"int":2}}}, "id":2}', '{"int":2, "double":2.2}'), -(3, 3, 3.3, 'ccc', '{"bool":true, "int":3, "double":3.3, "string":"ccc", "k1":{"k2":{"k3":{"int":3}}}, "id":3}', '{"int":3, "double":3.3}'), -(4, 4, 4.4, 'ddd', '{"bool":true, "int":4, "double":4.4, "string":"ddd", "k1":{"k2":{"k3":{"int":4}}}, "id":4}', '{"int":4, "double":4.4}'), -(5, 5, 5.5, 'eee', '{"bool":true, "int":5, "double":5.5, "string":"eee", "k1":{"k2":{"k3":{"int":5}}}, "id":5}', '{"int":5, "double":5.5}'), -(6, 6, 6.6, 'fff', '{"bool":false, "int":6, "double":6.6, "string":"fff", "k1":{"k2":{"k3":{"int":6}}}, "id":6}', '{"int":6, "double":6.6}'), -(7, 7, 7.7, 'ggg', '{"bool":false, "int":7, "double":7.7, "string":"ggg", "k1":{"k2":{"k3":{"int":7}}}, "id":7}', '{"int":7, "double":7.7}'), -(8, 8, 8.8, 'hhh', '{"bool":false, "int":8, "double":8.8, "string":"hhh", "k1":{"k2":{"k3":{"int":8}}}, "id":8}', '{"int":8, "double":8.8}'), -(9, 9, 9.9, 'iii', '{"bool":false, "int":9, "double":9.9, "string":"iii", "k1":{"k2":{"k3":{"int":9}}}, "id":9}', '{"int":9, "double":9.9}'); +(10, 10, 10.1, 'jjj', '{"bool":false, "int":10, "double":"10.1", "string":"", "k1":{"k2":{"k3":{"int":10}}},"id":10}', '{"int":10, "double":10.1}'), +(11, 11, 11.11, 'kkk', '{"bool":0, "int":"11.111","double":true, "string":"k", "k1":{"k2":{"k3":{"int":11}}},"id":11}', '{"__t":11, "double":11.11}'), +(1, 1, 1.1, 'aaa', '{"bool":true, "__t":1, "double":1, "string":"aaaaaaa", "k1":{"k2":{"k3":{"int":1}}}, "id":1}', '{"int":1, "double":1.1}'), +(2, 2, 2.2, 'bbb', '{"bool":"bbb", "int":true, "double":"2.2", "string":2.2, "k1":{"k2":{"k3":{"int":2}}}, "id":2}', '{"int":2, "___ble":2.2}'), +(3, 3, 3.3, 'ccc', '{"__ol":true, "int":3, "double":3.3, "string":true, "k1":{"k2":{"k3":{"int":3}}}, "id":3}', '{"i__":3, "dou___":3.3}'), +(5, 5, 5.5, 'eee', '{"bool":false, "int":5, "double":5.5, "string":"eee", "k1":{"k2":{"k3":{"int":5}}}, "id":5}', '{"int":5, "double":5.5}'), +(8, 8, 8.8, 'hhh', '{"bool":123456789, "int":8, "double":8.8, "string":"hhh", "k1":{"k2":{"k3":{"int":8}}}, "id":8}', '{"int":8, "double":8.8}'), +(9, 9, 9.9, 'iii', '{"bool":null, "int":null, "double":null, "string":null, "k1":null}', null); +insert into t1 (a1, b1, c1, d1, doc11) values +(12, 12, 12.12, 'lll', '{"bool":2.5, "int":false, "double":false, "string":12, "k1":{"k2":{"k3":{"int":12}}},"id":12}'), +(4, 4, 4.4, 'ddd', '{"bool":"ddddddd", "int":"44444", "___ble":4.4, "string":false, "k1":{"k2":{"k3":{"int":4}}}, "id":4}'), +(7, 7, 7.7, 'ggg', '{"bool":"", "int":7.777, "double":false, "___ing":"gg", "k1":{"k2":{"k3":{"int":7}}}, "id":7}'); +insert into t1 (a1, b1, c1, d1) values +(6, 6, 6.6, 'fff'); analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK +insert into t2 values +(10, 10, 10.1, 'jjj', '{"bool":false, "int":10, "double":"10.1", "string":"", "k1":{"k2":{"k3":{"int":10}}},"id":10}', '{"int":10, "double":10.1}'), +(11, 11, 11.11, 'kkk', '{"bool":0, "int":"11.111","double":true, "string":"k", "k1":{"k2":{"k3":{"int":11}}},"id":11}', '{"__t":11, "double":11.11}'), +(12, 12, 12.12, 'lll', null, null), +(1, 1, 1.1, 'aaa', '{"__ol":true, "int":1, "double":1, "string":"aaaaaaa", "k1":{"k2":{"k3":{"int":1}}}, "id":1}', '{"int":1, "double":1.1}'), +(2, 2, 2.2, 'bbb', '{"bool":"bbb", "int":true, "double":"2.2", "string":2.2, "k1":{"k2":{"k3":{"int":2}}}, "id":2}', '{"int":2, "___ble":2.2}'), +(3, 3, 3.3, 'ccc', '{"bool":true, "__t":3, "___ble":3.3, "string":true, "k1":{"k2":{"k3":{"int":3}}}, "id":3}', '{"i__":3, "dou___":3.3}'), +(4, 4, 4.4, 'ddd', '{"bool":"ddddddd", "int":4, "double":null, "string":false, "k1":{"k2":{"k3":{"int":4}}}, "id":4}', null), +(5, 5, 5.5, 'eee', null, '{"int":5, "double":5.5}'), +(6, 6, 6.6, 'fff', '{"bool":false, "int":"66666", "double":6, "string":null, "k1":{"k2":{"k3":{"int":6}}}, "id":6}', '{"int":6, "double":6.6}'), +(7, 7, 7.7, 'ggg', '{"bool":false, "int":7, "double":false, "___ing":"g", "k1":{"k2":{"k3":{"int":7}}}, "id":7}', null), +(8, 8, 8.8, 'hhh', '{"bool":123456789, "int":null, "double":8.8, "string":"hhh", "k1":{"k2":{"k3":{"int":8}}}, "id":8}', '{"int":8, "double":8.8}'), +(9, 9, 9.9, 'iii', '{"bool":false, "int":9, "double":9.9, "string":"iii", "k1":{"k2":{"k3":{"int":9}}}, "id":9}', '{"int":9, "double":9.9}'); +analyze table t2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +insert into t3 values +(1, 1, 1.1, 'aaa', '{"bool":true, "int":1, "double":1.1, "string":"aaa", "k1":{"k2":{"k3":{"int":1}}}, "id":1}', '{"int":1, "double":1.1}'), +(2, 2, 2.2, 'bbb', '{"bool":false, "int":2, "double":2.2, "string":"bbb", "k1":{"k2":{"k3":{"int":2}}}, "id":2}', '{"int":2, "double":2.2}'), +(8, 8, 8.8, 'hhh', '{"bool":true, "int":8, "double":8.8, "string":"hhh", "k1":{"k2":{"k3":{"int":8}}}, "id":8}', '{"int":8, "double":8.8}'), +(10, 10, 10.1, 'jjj', '{"bool":false, "int":10, "double":10.1, "string":"jjj", "k1":{"k2":{"k3":{"int":10}}},"id":10}', '{"int":10, "double":10.1}'); +insert into t3 (a3, b3, c3, d3) values +(11, 11, 11.11, 'kkk'), +(12, 12, 12.12, 'lll'), +(3, 3, 3.3, 'ccc'), +(4, 4, 4.4, 'ddd'), +(5, 5, 5.5, 'eee'), +(6, 6, 6.6, 'fff'), +(7, 7, 7.7, 'ggg'), +(9, 9, 9.9, 'iii'); +analyze table t3; +Table Op Msg_type Msg_text +test.t3 analyze status OK explain extended select * from t1 use document keys; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES select * from t1 use document keys; -a b c d doc1 doc2 -1 1 1.1 aaa {"bool":true,"int":1,"double":1.1,"string":"aaa","k1":{"k2":{"k3":{"int":1}}},"id":1} {"int":1,"double":1.1} -2 2 2.2 bbb {"bool":true,"int":2,"double":2.2,"string":"bbb","k1":{"k2":{"k3":{"int":2}}},"id":2} {"int":2,"double":2.2} -3 3 3.3 ccc {"bool":true,"int":3,"double":3.3,"string":"ccc","k1":{"k2":{"k3":{"int":3}}},"id":3} {"int":3,"double":3.3} -4 4 4.4 ddd {"bool":true,"int":4,"double":4.4,"string":"ddd","k1":{"k2":{"k3":{"int":4}}},"id":4} {"int":4,"double":4.4} -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select doc1 from t1 use document keys; +a1 b1 c1 d1 doc11 doc12 +1 1 1.1 aaa {"bool":true,"__t":1,"double":1,"string":"aaaaaaa","k1":{"k2":{"k3":{"int":1}}},"id":1} {"int":1,"double":1.1} +2 2 2.2 bbb {"bool":"bbb","int":true,"double":"2.2","string":2.2,"k1":{"k2":{"k3":{"int":2}}},"id":2} {"int":2,"___ble":2.2} +3 3 3.3 ccc {"__ol":true,"int":3,"double":3.3,"string":true,"k1":{"k2":{"k3":{"int":3}}},"id":3} {"i__":3,"dou___":3.3} +4 4 4.4 ddd {"bool":"ddddddd","int":"44444","___ble":4.4,"string":false,"k1":{"k2":{"k3":{"int":4}}},"id":4} NULL +5 5 5.5 eee {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} +6 6 6.6 fff NULL NULL +7 7 7.7 ggg {"bool":"","int":7.777,"double":false,"___ing":"gg","k1":{"k2":{"k3":{"int":7}}},"id":7} NULL +8 8 8.8 hhh {"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} +9 9 9.9 iii {"bool":null,"int":null,"double":null,"string":null,"k1":null} NULL +10 10 10.1 jjj {"bool":false,"int":10,"double":"10.1","string":"","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} +11 11 11.11 kkk {"bool":0,"int":"11.111","double":true,"string":"k","k1":{"k2":{"k3":{"int":11}}},"id":11} {"__t":11,"double":11.11} +12 12 12.12 lll {"bool":2.5,"int":false,"double":false,"string":12,"k1":{"k2":{"k3":{"int":12}}},"id":12} NULL +explain extended select doc11 from t1 use document keys; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES -select doc1 from t1 use document keys; -doc1 -{"bool":true,"int":1,"double":1.1,"string":"aaa","k1":{"k2":{"k3":{"int":1}}},"id":1} -{"bool":true,"int":2,"double":2.2,"string":"bbb","k1":{"k2":{"k3":{"int":2}}},"id":2} -{"bool":true,"int":3,"double":3.3,"string":"ccc","k1":{"k2":{"k3":{"int":3}}},"id":3} -{"bool":true,"int":4,"double":4.4,"string":"ddd","k1":{"k2":{"k3":{"int":4}}},"id":4} -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -{"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} -{"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} -{"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} -{"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} -{"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} -{"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} -{"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} -explain extended select doc2 from t1 use document keys; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` USE DOCUMENT INDEXES +select doc11 from t1 use document keys; +doc11 +{"bool":true,"__t":1,"double":1,"string":"aaaaaaa","k1":{"k2":{"k3":{"int":1}}},"id":1} +{"bool":"bbb","int":true,"double":"2.2","string":2.2,"k1":{"k2":{"k3":{"int":2}}},"id":2} +{"__ol":true,"int":3,"double":3.3,"string":true,"k1":{"k2":{"k3":{"int":3}}},"id":3} +{"bool":"ddddddd","int":"44444","___ble":4.4,"string":false,"k1":{"k2":{"k3":{"int":4}}},"id":4} +{"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +NULL +{"bool":"","int":7.777,"double":false,"___ing":"gg","k1":{"k2":{"k3":{"int":7}}},"id":7} +{"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} +{"bool":null,"int":null,"double":null,"string":null,"k1":null} +{"bool":false,"int":10,"double":"10.1","string":"","k1":{"k2":{"k3":{"int":10}}},"id":10} +{"bool":0,"int":"11.111","double":true,"string":"k","k1":{"k2":{"k3":{"int":11}}},"id":11} +{"bool":2.5,"int":false,"double":false,"string":12,"k1":{"k2":{"k3":{"int":12}}},"id":12} +explain extended select doc12 from t1 use document keys; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES -select doc2 from t1 use document keys; -doc2 +Note 1003 /* select#1 */ select `test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES +select doc12 from t1 use document keys; +doc12 {"int":1,"double":1.1} -{"int":2,"double":2.2} -{"int":3,"double":3.3} -{"int":4,"double":4.4} +{"int":2,"___ble":2.2} +{"i__":3,"dou___":3.3} +NULL {"int":5,"double":5.5} -{"int":6,"double":6.6} -{"int":7,"double":7.7} +NULL +NULL {"int":8,"double":8.8} -{"int":9,"double":9.9} +NULL {"int":10,"double":10.1} -{"int":11,"double":11.11} -{"int":12,"double":12.12} -explain extended select a from t1 where doc1.bool is true; +{"__t":11,"double":11.11} +NULL +select a1 from t1 where doc11 is null; +a1 +6 +select a1 from t1 where doc11 is not null; +a1 +1 +2 +3 +4 +5 +7 +8 +9 +10 +11 +12 +select a1 from t1 use document keys where doc11 is null; +a1 +6 +select a1 from t1 use document keys where doc11 is not null; +a1 +1 +2 +3 +4 +5 +7 +8 +9 +10 +11 +12 +FIXME!! This isn't necessarily a bug but it is confusing! +The results of "is [not] null" with / without document key enabled can +be different. The reason is that, with document keys disabled, there are +no type for `doc11`.`bool` so as long as the document path exists and +its value is not null, it will be treated as not null. But when document +kyes are enabled, document path `doc11`.`bool` may pick up a type from +document keys, e.g. Boolean type, and the document path values will be +retrieved from that index instead of the original document, so even the +value of the document path is not null in the document but it still can +be null as Boolean type in index. e.g. {"bool":"key as bool will be null"}, +so different results will be observed with the same query. +explain extended select a1 from t1 where doc11.bool is null; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc1`.`bool` is true) -select a from t1 where doc1.bool is true; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where isnull(`test`.`t1`.`doc11`.`bool`) +select a1 from t1 where doc11.bool is null; +a1 +3 +6 +9 +select a1 from t1 where doc11.bool is not null; +a1 1 2 -3 4 5 -explain extended select a from t1 use document keys where doc1.bool is true; +7 +8 +10 +11 +12 +explain extended select a1 from t1 use document keys where doc11.bool is null; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 ref doc11_bool doc11_bool 2 const 6 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`bool` is true) -select a from t1 use document keys where doc1.bool is true; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where isnull(`test`.`t1`.`doc11`.`bool`) +select a1 from t1 use document keys where doc11.bool is null; +a1 +2 +3 +4 +6 +7 +9 +select a1 from t1 use document keys where doc11.bool is not null; +a1 +5 +10 +11 +1 +8 +12 +select a1 from t1 where doc11.int is null; +a1 1 +6 +9 +select a1 from t1 where doc11.int is not null; +a1 2 3 4 5 -explain extended select count(a) from t1 use document keys group by doc1.bool; +7 +8 +10 +11 +12 +select a1 from t1 use document keys where doc11.int is null; +a1 +1 +6 +9 +select a1 from t1 use document keys where doc11.int is not null; +a1 +12 +2 +3 +5 +7 +8 +10 +11 +4 +select a1 from t1 where doc11.double is null; +a1 +4 +6 +9 +select a1 from t1 where doc11.double is not null; +a1 +1 +2 +3 +5 +7 +8 +10 +11 +12 +select a1 from t1 use document keys where doc11.double is null; +a1 +4 +6 +9 +select a1 from t1 use document keys where doc11.double is not null; +a1 +7 +12 +1 +11 +2 +3 +5 +8 +10 +select a1 from t1 where doc11.string is null; +a1 +6 +7 +9 +select a1 from t1 where doc11.string is not null; +a1 +1 +2 +3 +4 +5 +8 +10 +11 +12 +select a1 from t1 use document keys where doc11.string is null; +a1 +6 +7 +9 +select a1 from t1 use document keys where doc11.string is not null; +a1 +1 +2 +3 +4 +5 +8 +10 +11 +12 +explain extended select a1 from t1 where doc11.bool is true; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`a`) AS `count(a)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select count(a) from t1 use document keys group by doc1.bool; -count(a) +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`bool` is true) +select a1 from t1 where doc11.bool is true; +a1 +1 +8 +12 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select a1 from t1 where doc11.bool is false; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`bool` is false) +select a1 from t1 where doc11.bool is false; +a1 +2 +4 +5 7 +10 +11 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select a1 from t1 use document keys where doc11.bool is true; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` is true) +select a1 from t1 use document keys where doc11.bool is true; +a1 +1 +8 +12 +FIXME!! (this isn't necessarily a bug): different results with / without indexes +explain extended select a1 from t1 use document keys where doc11.bool is false; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` is false) +select a1 from t1 use document keys where doc11.bool is false; +a1 5 -explain extended select sum(a) from t1 use document keys group by doc1.bool; +10 +11 +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select sum(`test`.`t1`.`a`) AS `sum(a)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select sum(a) from t1 use document keys group by doc1.bool; -sum(a) -63 -15 -explain extended select avg(a) from t1 use document keys group by doc1.bool; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` > 0) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0; +`doc11`.`bool` +true +true +true +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool < 1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index doc11_bool doc11_bool 2 NULL 12 16.67 Using where; Using index Warnings: -Note 1003 /* select#1 */ select avg(`test`.`t1`.`a`) AS `avg(a)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select avg(a) from t1 use document keys group by doc1.bool; -avg(a) -9.0000 -3.0000 -explain extended select doc1.bool from t1 where doc1.bool is true; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` < 1) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool < 1; +`doc11`.`bool` +false +false +false +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool < 1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` > 0) and (`test`.`t1`.`doc11`.`bool` < 1)) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool < 1; +`doc11`.`bool` +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool >= 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 6 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`bool` AS "`doc1`.`bool`" from `test`.`t1` where (`test`.`t1`.`doc1`.`bool` is true) -select doc1.bool from t1 where doc1.bool is true; -`doc1`.`bool` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` >= 0) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool >= 0; +`doc11`.`bool` +false +false +false +true true true +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool <= 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` > 0) and (`test`.`t1`.`doc11`.`bool` <= 1)) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool <= 1; +`doc11`.`bool` +true +true +true +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool between 0 and 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 6 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` between 0 and 1) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool between 0 and 1; +`doc11`.`bool` +false +false +false true true true -explain extended select doc1.bool from t1 use document keys where doc1.bool is true; +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool not between 0 and 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index doc11_bool doc11_bool 2 NULL 12 16.67 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` not between 0 and 1) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool not between 0 and 1; +`doc11`.`bool` +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0, 1); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 6 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`bool` AS "`doc1`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`bool` is true) -select doc1.bool from t1 use document keys where doc1.bool is true; -`doc1`.`bool` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` in (0,1)) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0, 1); +`doc11`.`bool` +false +false +false true true true +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref doc11_bool doc11_bool 2 const 3 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` = 0) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0); +`doc11`.`bool` +false +false +false +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool not in (1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` <> 1) +select t1.doc11.bool from t1 use document keys where t1.doc11.bool not in (1); +`doc11`.`bool` +false +false +false +explain extended select t1.doc11.bool from t1 use document keys +where (t1.doc11.bool >= 0 and t1.doc11.bool <= 255) and (t1.doc11.bool not in (0)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` >= 0) and (`test`.`t1`.`doc11`.`bool` <= 255) and (`test`.`t1`.`doc11`.`bool` <> 0)) +select t1.doc11.bool from t1 use document keys +where (t1.doc11.bool >= 0 and t1.doc11.bool <= 255) and (t1.doc11.bool not in (0)); +`doc11`.`bool` true true -explain extended select count(doc1.bool) from t1 use document keys group by doc1.bool; +true +explain extended select count(a1) from t1 use document keys group by doc11.bool; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`.`bool`) AS `count(doc1.bool)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select count(doc1.bool) from t1 use document keys group by doc1.bool; -count(doc1.bool) -7 -5 -explain extended select sum(doc1.bool) from t1 use document keys group by doc1.bool; +Note 1003 /* select#1 */ select count(`test`.`t1`.`a1`) AS `count(a1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select count(a1) from t1 use document keys group by doc11.bool; +count(a1) +6 +3 +3 +explain extended select sum(a1) from t1 use document keys group by doc11.bool; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select sum(`test`.`t1`.`a1`) AS `sum(a1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select sum(a1) from t1 use document keys group by doc11.bool; +sum(a1) +31 +26 +21 +explain extended select avg(a1) from t1 use document keys group by doc11.bool; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select avg(`test`.`t1`.`a1`) AS `avg(a1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select avg(a1) from t1 use document keys group by doc11.bool; +avg(a1) +5.1667 +8.6667 +7.0000 +explain extended select doc11.bool from t1 where doc11.bool is true; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` where (`test`.`t1`.`doc11`.`bool` is true) +select doc11.bool from t1 where doc11.bool is true; +`doc11`.`bool` +true +123456789 +2.5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select doc11.bool from t1 use document keys where doc11.bool is true; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` is true) +select doc11.bool from t1 use document keys where doc11.bool is true; +`doc11`.`bool` +true +true +true +explain extended select count(doc11.bool) from t1 use document keys group by doc11.bool; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc1`.`bool`) AS `sum(doc1.bool)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select sum(doc1.bool) from t1 use document keys group by doc1.bool; -sum(doc1.bool) +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`.`bool`) AS `count(doc11.bool)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select count(doc11.bool) from t1 use document keys group by doc11.bool; +count(doc11.bool) 0 -5 -explain extended select avg(doc1.bool) from t1 use document keys group by doc1.bool; +3 +3 +explain extended select sum(doc11.bool) from t1 use document keys group by doc11.bool; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc11`.`bool`) AS `sum(doc11.bool)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select sum(doc11.bool) from t1 use document keys group by doc11.bool; +sum(doc11.bool) +NULL +0 +3 +explain extended select avg(doc11.bool) from t1 use document keys group by doc11.bool; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select avg(`test`.`t1`.`doc1`.`bool`) AS `avg(doc1.bool)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select avg(doc1.bool) from t1 use document keys group by doc1.bool; -avg(doc1.bool) +Note 1003 /* select#1 */ select avg(`test`.`t1`.`doc11`.`bool`) AS `avg(doc11.bool)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select avg(doc11.bool) from t1 use document keys group by doc11.bool; +avg(doc11.bool) +NULL 0 1 -explain extended select a from t1; +explain extended select a1 from t1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL b_a 9 NULL 12 100.00 Using index +1 SIMPLE t1 index NULL b1_a1 9 NULL 12 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` -select a from t1; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` +select a1 from t1; +a1 1 2 3 @@ -221,1931 +629,3937 @@ a 10 11 12 -explain extended select a from t1 use document keys; +explain extended select a1 from t1 use document keys; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using index +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES -select a from t1 use document keys; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES +select a1 from t1 use document keys; +a1 +2 +3 +4 6 7 -8 9 +5 10 11 -12 1 -2 +8 +12 +explain extended select * from t1 where doc11.bool is true; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` where (`test`.`t1`.`doc11`.`bool` is true) +select * from t1 where doc11.bool is true; +a1 b1 c1 d1 doc11 doc12 +1 1 1.1 aaa {"bool":true,"__t":1,"double":1,"string":"aaaaaaa","k1":{"k2":{"k3":{"int":1}}},"id":1} {"int":1,"double":1.1} +8 8 8.8 hhh {"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} +12 12 12.12 lll {"bool":2.5,"int":false,"double":false,"string":12,"k1":{"k2":{"k3":{"int":12}}},"id":12} NULL +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select * from t1 use document keys where doc11.bool is true; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` is true) +select * from t1 use document keys where doc11.bool is true; +a1 b1 c1 d1 doc11 doc12 +1 1 1.1 aaa {"bool":true,"__t":1,"double":1,"string":"aaaaaaa","k1":{"k2":{"k3":{"int":1}}},"id":1} {"int":1,"double":1.1} +8 8 8.8 hhh {"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} +12 12 12.12 lll {"bool":2.5,"int":false,"double":false,"string":12,"k1":{"k2":{"k3":{"int":12}}},"id":12} NULL +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` > 0) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0; +`doc11`.`int` `doc11`.`bool` +NULL true +8 123456789 +false 2.5 +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool < 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` < 1) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool < 1; +`doc11`.`int` `doc11`.`bool` +5 false +10 false +11.111 0 +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool < 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` > 0) and (`test`.`t1`.`doc11`.`bool` < 1)) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool < 1; +`doc11`.`int` `doc11`.`bool` +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool >= 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` >= 0) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool >= 0; +`doc11`.`int` `doc11`.`bool` +NULL true +true bbb +44444 ddddddd +5 false +7.777 +8 123456789 +10 false +11.111 0 +false 2.5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool <= 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` > 0) and (`test`.`t1`.`doc11`.`bool` <= 1)) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool <= 1; +`doc11`.`int` `doc11`.`bool` +NULL true +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool between 0 and 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` between 0 and 1) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool between 0 and 1; +`doc11`.`int` `doc11`.`bool` +NULL true +true bbb +44444 ddddddd +5 false +7.777 +10 false +11.111 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool not between 0 and 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` not between 0 and 1) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool not between 0 and 1; +`doc11`.`int` `doc11`.`bool` +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0, 1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` in (0,1)) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0, 1); +`doc11`.`int` `doc11`.`bool` +NULL true +true bbb +44444 ddddddd +5 false +7.777 +10 false +11.111 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref doc11_bool doc11_bool 2 const 3 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` = 0) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0); +`doc11`.`int` `doc11`.`bool` +5 false +10 false +11.111 0 +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool not in (1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 25.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` <> 1) +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool not in (1); +`doc11`.`int` `doc11`.`bool` +true bbb +44444 ddddddd +5 false +7.777 +8 123456789 +10 false +11.111 0 +false 2.5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys +where (t1.doc11.bool >= 0 and t1.doc11.bool <= 255) and (t1.doc11.bool not in (0)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` >= 0) and (`test`.`t1`.`doc11`.`bool` <= 255) and (`test`.`t1`.`doc11`.`bool` <> 0)) +select t1.doc11.int, t1.doc11.bool from t1 use document keys +where (t1.doc11.bool >= 0 and t1.doc11.bool <= 255) and (t1.doc11.bool not in (0)); +`doc11`.`int` `doc11`.`bool` +NULL true +explain extended select count(*) from t1 use document keys group by doc11.bool; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc11_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select count(*) from t1 use document keys group by doc11.bool; +count(*) +6 3 -4 -5 -explain extended select * from t1 where doc1.bool is true; +3 +explain extended select doc11 from t1 where doc11.bool is true; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc1`.`bool` is true) -select * from t1 where doc1.bool is true; -a b c d doc1 doc2 -1 1 1.1 aaa {"bool":true,"int":1,"double":1.1,"string":"aaa","k1":{"k2":{"k3":{"int":1}}},"id":1} {"int":1,"double":1.1} -2 2 2.2 bbb {"bool":true,"int":2,"double":2.2,"string":"bbb","k1":{"k2":{"k3":{"int":2}}},"id":2} {"int":2,"double":2.2} -3 3 3.3 ccc {"bool":true,"int":3,"double":3.3,"string":"ccc","k1":{"k2":{"k3":{"int":3}}},"id":3} {"int":3,"double":3.3} -4 4 4.4 ddd {"bool":true,"int":4,"double":4.4,"string":"ddd","k1":{"k2":{"k3":{"int":4}}},"id":4} {"int":4,"double":4.4} -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -explain extended select * from t1 use document keys where doc1.bool is true; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` where (`test`.`t1`.`doc11`.`bool` is true) +select doc11 from t1 where doc11.bool is true; +doc11 +{"bool":true,"__t":1,"double":1,"string":"aaaaaaa","k1":{"k2":{"k3":{"int":1}}},"id":1} +{"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} +{"bool":2.5,"int":false,"double":false,"string":12,"k1":{"k2":{"k3":{"int":12}}},"id":12} +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select doc11 from t1 use document keys where doc11.bool is true; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`bool` is true) -select * from t1 use document keys where doc1.bool is true; -a b c d doc1 doc2 -1 1 1.1 aaa {"bool":true,"int":1,"double":1.1,"string":"aaa","k1":{"k2":{"k3":{"int":1}}},"id":1} {"int":1,"double":1.1} -2 2 2.2 bbb {"bool":true,"int":2,"double":2.2,"string":"bbb","k1":{"k2":{"k3":{"int":2}}},"id":2} {"int":2,"double":2.2} -3 3 3.3 ccc {"bool":true,"int":3,"double":3.3,"string":"ccc","k1":{"k2":{"k3":{"int":3}}},"id":3} {"int":3,"double":3.3} -4 4 4.4 ddd {"bool":true,"int":4,"double":4.4,"string":"ddd","k1":{"k2":{"k3":{"int":4}}},"id":4} {"int":4,"double":4.4} -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -explain extended select count(*) from t1 use document keys group by doc1.bool; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` is true) +select doc11 from t1 use document keys where doc11.bool is true; +doc11 +{"bool":true,"__t":1,"double":1,"string":"aaaaaaa","k1":{"k2":{"k3":{"int":1}}},"id":1} +{"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} +{"bool":2.5,"int":false,"double":false,"string":12,"k1":{"k2":{"k3":{"int":12}}},"id":12} +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select count(doc11) from t1 use document keys group by doc11.bool; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_bool 2 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select count(*) from t1 use document keys group by doc1.bool; -count(*) -7 -5 -explain extended select doc1 from t1 where doc1.bool is true; +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`) AS `count(doc11)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select count(doc11) from t1 use document keys group by doc11.bool; +count(doc11) +2 +1 +1 +2 +1 +1 +1 +1 +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select doc11.int from t1 where doc11.bool is true; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` where (`test`.`t1`.`doc1`.`bool` is true) -select doc1 from t1 where doc1.bool is true; -doc1 -{"bool":true,"int":1,"double":1.1,"string":"aaa","k1":{"k2":{"k3":{"int":1}}},"id":1} -{"bool":true,"int":2,"double":2.2,"string":"bbb","k1":{"k2":{"k3":{"int":2}}},"id":2} -{"bool":true,"int":3,"double":3.3,"string":"ccc","k1":{"k2":{"k3":{"int":3}}},"id":3} -{"bool":true,"int":4,"double":4.4,"string":"ddd","k1":{"k2":{"k3":{"int":4}}},"id":4} -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select doc1 from t1 use document keys where doc1.bool is true; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`doc11`.`bool` is true) +select doc11.int from t1 where doc11.bool is true; +`doc11`.`int` +NULL +8 +false +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select doc11.int from t1 use document keys where doc11.bool is true; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`bool` is true) -select doc1 from t1 use document keys where doc1.bool is true; -doc1 -{"bool":true,"int":1,"double":1.1,"string":"aaa","k1":{"k2":{"k3":{"int":1}}},"id":1} -{"bool":true,"int":2,"double":2.2,"string":"bbb","k1":{"k2":{"k3":{"int":2}}},"id":2} -{"bool":true,"int":3,"double":3.3,"string":"ccc","k1":{"k2":{"k3":{"int":3}}},"id":3} -{"bool":true,"int":4,"double":4.4,"string":"ddd","k1":{"k2":{"k3":{"int":4}}},"id":4} -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select count(doc1) from t1 use document keys group by doc1.bool; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`bool` is true) +select doc11.int from t1 use document keys where doc11.bool is true; +`doc11`.`int` +NULL +8 +false +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select count(doc11.int) from t1 use document keys group by doc11.bool; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`) AS `count(doc1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select count(doc1) from t1 use document keys group by doc1.bool; -count(doc1) +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`.`int`) AS `count(doc11.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`bool` +select count(doc11.int) from t1 use document keys group by doc11.bool; +count(doc11.int) +1 +1 +1 +2 +1 +1 +0 +1 +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'bbb' +Warning 1292 Truncated incorrect DOUBLE value: 'ddddddd' +explain extended select a1 from t1 where doc11.int > 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` > 5) +select a1 from t1 where doc11.int > 5; +a1 +4 +7 +8 +10 +11 +explain extended select a1 from t1 use document keys where doc11.int > 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 5 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` > 5) +select a1 from t1 use document keys where doc11.int > 5; +a1 7 +8 +10 +11 +4 +explain extended select doc11.int from t1 use document keys where doc11.int >= 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 6 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` >= 5) +select doc11.int from t1 use document keys where doc11.int >= 5; +`doc11`.`int` 5 -explain extended select doc1.int from t1 where doc1.bool is true; +7 +8 +10 +11 +44444 +explain extended select a1 from t1 use document keys where doc11.int > 13; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 1 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where (`test`.`t1`.`doc1`.`bool` is true) -select doc1.int from t1 where doc1.bool is true; -`doc1`.`int` -1 -2 -3 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` > 13) +select a1 from t1 use document keys where doc11.int > 13; +a1 4 +explain extended select a1, doc11.int from t1 use document keys where doc11.int < 9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 5 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` < 9) +select a1, doc11.int from t1 use document keys where doc11.int < 9; +a1 `doc11`.`int` +12 0 +2 1 +3 3 +5 5 +7 7 +8 8 +explain extended select doc11.int, a1 from t1 use document keys where doc11.int <= 9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 6 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` <= 9) +select doc11.int, a1 from t1 use document keys where doc11.int <= 9; +`doc11`.`int` a1 +0 12 +1 2 +3 3 +5 5 +7 7 +8 8 +explain extended select doc11.int from t1 use document keys where doc11.int < 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` < 1) +select doc11.int from t1 use document keys where doc11.int < 1; +`doc11`.`int` +0 +explain extended select a1, doc11.int from t1 use document keys where doc11.int > 5 and doc11.int < 9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` > 5) and (`test`.`t1`.`doc11`.`int` < 9)) +select a1, doc11.int from t1 use document keys where doc11.int > 5 and doc11.int < 9; +a1 `doc11`.`int` +7 7 +8 8 +explain extended select a1 from t1 use document keys where doc11.int >= 5 and doc11.int <= 9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` >= 5) and (`test`.`t1`.`doc11`.`int` <= 9)) +select a1 from t1 use document keys where doc11.int >= 5 and doc11.int <= 9; +a1 5 -explain extended select doc1.int from t1 use document keys where doc1.bool is true; +7 +8 +explain extended select a1 from t1 use document keys where doc11.int > 0 and doc11.int < 130; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 6 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`bool` is true) -select doc1.int from t1 use document keys where doc1.bool is true; -`doc1`.`int` -1 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` > 0) and (`test`.`t1`.`doc11`.`int` < 130)) +select a1 from t1 use document keys where doc11.int > 0 and doc11.int < 130; +a1 2 3 -4 5 -explain extended select count(doc1.int) from t1 use document keys group by doc1.bool; +7 +8 +10 +11 +explain extended select a1, doc11.int from t1 use document keys where doc11.int between 5 and 9; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 3 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`.`int`) AS `count(doc1.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`bool` -select count(doc1.int) from t1 use document keys group by doc1.bool; -count(doc1.int) -7 -5 -explain extended select a from t1 where doc1.int > 5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` between 5 and 9) +select a1, doc11.int from t1 use document keys where doc11.int between 5 and 9; +a1 `doc11`.`int` +5 5 +7 7 +8 8 +explain extended select doc11.int from t1 use document keys where doc11.int between 5 and 15; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 5 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` > 5) -select a from t1 where doc1.int > 5; -a -6 +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` between 5 and 15) +select doc11.int from t1 use document keys where doc11.int between 5 and 15; +`doc11`.`int` +5 7 8 -9 10 11 -12 -explain extended select a from t1 use document keys where doc1.int > 5; +explain extended select a1, doc11.int from t1 use document keys where doc11.int not between 5 and 9; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_int 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 5 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) -select a from t1 use document keys where doc1.int > 5; -a -6 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not between 5 and 9) +select a1, doc11.int from t1 use document keys where doc11.int not between 5 and 9; +a1 `doc11`.`int` +12 0 +2 1 +3 3 +10 10 +11 11 +4 44444 +explain extended select a1, doc11.int from t1 use document keys where doc11.int not between 5 and 130; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not between 5 and 130) +select a1, doc11.int from t1 use document keys where doc11.int not between 5 and 130; +a1 `doc11`.`int` +12 0 +2 1 +3 3 +4 44444 +explain extended select a1, doc11.int from t1 use document keys where doc11.int in (5, 7, 9, 12); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 4 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` in (5,7,9,12)) +select a1, doc11.int from t1 use document keys where doc11.int in (5, 7, 9, 12); +a1 `doc11`.`int` +5 5 +7 7 +explain extended select a1, doc11.int from t1 use document keys where doc11.int in (5, 100, 0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` in (5,100,0)) +select a1, doc11.int from t1 use document keys where doc11.int in (5, 100, 0); +a1 `doc11`.`int` +12 0 +5 5 +explain extended select a1, doc11.int from t1 use document keys where doc11.int not in (5, 7, 9, 12); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 6 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not in (5,7,9,12)) +select a1, doc11.int from t1 use document keys where doc11.int not in (5, 7, 9, 12); +a1 `doc11`.`int` +12 0 +2 1 +3 3 +8 8 +10 10 +11 11 +4 44444 +explain extended select a1, doc11.int from t1 use document keys where doc11.int not in (0, 100, 5, 6, 7, 12, 11, 10); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 9 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not in (0,100,5,6,7,12,11,10)) +select a1, doc11.int from t1 use document keys where doc11.int not in (0, 100, 5, 6, 7, 12, 11, 10); +a1 `doc11`.`int` +2 1 +3 3 +8 8 +4 44444 +explain extended select doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int > 6 and doc11.int < 8 or +doc11.int > 9 and doc11.int < 11 or doc11.int >= 12 and doc11.int <= 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 4 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`int` > 3) and (`test`.`t1`.`doc11`.`int` < 5)) or ((`test`.`t1`.`doc11`.`int` > 6) and (`test`.`t1`.`doc11`.`int` < 8)) or ((`test`.`t1`.`doc11`.`int` > 9) and (`test`.`t1`.`doc11`.`int` < 11)) or ((`test`.`t1`.`doc11`.`int` >= 12) and (`test`.`t1`.`doc11`.`int` <= 15))) +select doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int > 6 and doc11.int < 8 or +doc11.int > 9 and doc11.int < 11 or doc11.int >= 12 and doc11.int <= 15; +`doc11`.`int` +7 +10 +explain extended select doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 8 or doc11.int > 5 and doc11.int < 9 or +doc11.int > 7 and doc11.int <= 15 or doc11.int >= 12 and doc11.int < 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 5 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`int` > 3) and (`test`.`t1`.`doc11`.`int` < 8)) or ((`test`.`t1`.`doc11`.`int` > 5) and (`test`.`t1`.`doc11`.`int` < 9)) or ((`test`.`t1`.`doc11`.`int` > 7) and (`test`.`t1`.`doc11`.`int` <= 15)) or ((`test`.`t1`.`doc11`.`int` >= 12) and (`test`.`t1`.`doc11`.`int` < 15))) +select doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 8 or doc11.int > 5 and doc11.int < 9 or +doc11.int > 7 and doc11.int <= 15 or doc11.int >= 12 and doc11.int < 15; +`doc11`.`int` +5 7 8 -9 10 11 -12 -explain extended select count(a) from t1 use document keys group by doc1.int having doc1.int > 5; +explain extended select doc11.int from t1 use document keys +where ((doc11.int > 3 and doc11.int < 8) and (doc11.int not between 6 and 9)) or +((doc11.int between 11 and 15) and (doc11.int not in (4, 5))); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index doc11_int doc11_int 9 NULL 12 16.67 Using where; Using index Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`a`) AS `count(a)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`int` having (`test`.`t1`.`doc1`.`int` > 5) -select count(a) from t1 use document keys group by doc1.int having doc1.int > 5; -count(a) -1 -1 +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`int` > 3) and (`test`.`t1`.`doc11`.`int` < 8) and (`test`.`t1`.`doc11`.`int` not between 6 and 9)) or ((`test`.`t1`.`doc11`.`int` between 11 and 15) and (`test`.`t1`.`doc11`.`int` not in (4,5)))) +select doc11.int from t1 use document keys +where ((doc11.int > 3 and doc11.int < 8) and (doc11.int not between 6 and 9)) or +((doc11.int between 11 and 15) and (doc11.int not in (4, 5))); +`doc11`.`int` +5 +11 +explain extended select count(a1) from t1 use document keys group by doc11.int having doc11.int > 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc11_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select count(`test`.`t1`.`a1`) AS `count(a1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`int` having (`test`.`t1`.`doc11`.`int` > 5) +select count(a1) from t1 use document keys group by doc11.int having doc11.int > 5; +count(a1) 1 1 1 1 1 -explain extended select a from t1 use document keys order by doc1.int; +explain extended select a1 from t1 use document keys order by doc11.int; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES order by `test`.`t1`.`doc1`.`int` -select a from t1 use document keys order by doc1.int; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES order by `test`.`t1`.`doc11`.`int` +select a1 from t1 use document keys order by doc11.int; +a1 1 +6 +9 +12 2 3 -4 5 -6 7 8 -9 10 11 -12 -explain extended select a from t1 use document keys order by doc1.int as string; +4 +explain extended select a1 from t1 use document keys order by doc11.int as string; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES order by `test`.`t1`.`doc1`.`int` -select a from t1 use document keys order by doc1.int as string; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES order by `test`.`t1`.`doc11`.`int` +select a1 from t1 use document keys order by doc11.int as string; +a1 1 -10 -11 +6 +9 12 2 +10 +11 3 4 5 -6 7 8 -9 -select a from t1 order by doc1.int as string; -a +select a1 from t1 order by doc11.int as string; +a1 1 +6 +9 10 11 -12 -2 3 4 5 -6 7 8 -9 -explain extended select b from t1 use document keys order by doc1.double as string; +12 +2 +explain extended select b1 from t1 use document keys order by doc11.double as string; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` USE DOCUMENT INDEXES order by `test`.`t1`.`doc1`.`double` -select c from t1 use document keys order by doc1.double as string; -c +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` USE DOCUMENT INDEXES order by `test`.`t1`.`doc11`.`double` +select c1 from t1 use document keys order by doc11.double as string; +c1 +4.4 +6.6 +9.9 +7.7 +12.12 1.1 -10.1 11.11 -12.12 +10.1 2.2 3.3 -4.4 5.5 -6.6 -7.7 8.8 +select c1 from t1 order by doc11.double as string; +c1 +4.4 +6.6 9.9 -select c from t1 order by doc1.double as string; -c 1.1 10.1 -11.11 -12.12 2.2 3.3 -4.4 5.5 -6.6 -7.7 8.8 -9.9 -explain extended select doc1.int from t1 where doc1.int > 5; +7.7 +12.12 +11.11 +explain extended select doc11.int from t1 where doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where (`test`.`t1`.`doc1`.`int` > 5) -select doc1.int from t1 where doc1.int > 5; -`doc1`.`int` -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`doc11`.`int` > 5) +select doc11.int from t1 where doc11.int > 5; +`doc11`.`int` +44444 +7.777 8 -9 10 -11 -12 -explain extended select doc1.int from t1 use document keys where doc1.int > 5; +11.111 +explain extended select doc11.int from t1 use document keys where doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_int 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 5 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) -select doc1.int from t1 use document keys where doc1.int > 5; -`doc1`.`int` -6 +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` > 5) +select doc11.int from t1 use document keys where doc11.int > 5; +`doc11`.`int` 7 8 -9 10 11 -12 -explain extended select count(doc1.int) from t1 use document keys group by doc1.int having doc1.int > 5 ; +44444 +explain extended select count(doc11.int) from t1 use document keys group by doc11.int having doc11.int > 5 ; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`.`int`) AS `count(doc1.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`int` having (`test`.`t1`.`doc1`.`int` > 5) -select count(doc1.int) from t1 use document keys group by doc1.int having doc1.int > 5 ; -count(doc1.int) +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`.`int`) AS `count(doc11.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`int` having (`test`.`t1`.`doc11`.`int` > 5) +select count(doc11.int) from t1 use document keys group by doc11.int having doc11.int > 5 ; +count(doc11.int) 1 1 1 1 1 -1 -1 -explain extended select count(doc1.int) from t1 use document keys where doc1.int > 5 group by doc1.int; +explain extended select count(doc11.int) from t1 use document keys where doc11.int > 5 group by doc11.int; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_int 9 NULL 12 100.00 Using where; Using index; Using temporary; Using filesort +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 5 100.00 Using where; Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`.`int`) AS `count(doc1.int)` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) group by `test`.`t1`.`doc1`.`int` -select count(doc1.int) from t1 use document keys where doc1.int > 5 group by doc1.int; -count(doc1.int) -1 -1 +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`.`int`) AS `count(doc11.int)` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` > 5) group by `test`.`t1`.`doc11`.`int` +select count(doc11.int) from t1 use document keys where doc11.int > 5 group by doc11.int; +count(doc11.int) 1 1 1 1 1 -explain extended select count(a) from t1 use document keys where doc1.int = 5 group by doc1.int; +explain extended select count(a1) from t1 use document keys where doc11.int = 5 group by doc11.int; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where; Using index; Using temporary; Using filesort +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`a`) AS `count(a)` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) group by `test`.`t1`.`doc1`.`int` -select count(a) from t1 use document keys where doc1.int = 5 group by doc1.int; -count(a) +Note 1003 /* select#1 */ select count(`test`.`t1`.`a1`) AS `count(a1)` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) group by `test`.`t1`.`doc11`.`int` +select count(a1) from t1 use document keys where doc11.int = 5 group by doc11.int; +count(a1) 1 -explain extended select a from t1 where doc2.int > 5; +explain extended select a1 from t1 where doc12.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc2`.`int` > 5) -select a from t1 where doc2.int > 5; -a -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc12`.`int` > 5) +select a1 from t1 where doc12.int > 5; +a1 8 -9 10 -11 -12 -explain extended select a from t1 use document keys where doc2.int > 5; +explain extended select a1 from t1 use document keys where doc12.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc2_int doc2_int 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc12_int doc12_int 9 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`int` > 5) -select a from t1 use document keys where doc2.int > 5; -a -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc12`.`int` > 5) +select a1 from t1 use document keys where doc12.int > 5; +a1 8 -9 10 -11 -12 -explain extended select count(a) from t1 use document keys group by doc2.int having doc2.int > 5; +explain extended select count(a1) from t1 use document keys group by doc12.int having doc12.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc2_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc12_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`a`) AS `count(a)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`int` having (`test`.`t1`.`doc2`.`int` > 5) -select count(a) from t1 use document keys group by doc2.int having doc2.int > 5; -count(a) -1 -1 +Note 1003 /* select#1 */ select count(`test`.`t1`.`a1`) AS `count(a1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`int` having (`test`.`t1`.`doc12`.`int` > 5) +select count(a1) from t1 use document keys group by doc12.int having doc12.int > 5; +count(a1) 1 1 -1 -1 -1 -explain extended select doc2.int from t1 where doc2.int > 5; +explain extended select doc12.int from t1 where doc12.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2`.`int` AS "`doc2`.`int`" from `test`.`t1` where (`test`.`t1`.`doc2`.`int` > 5) -select doc2.int from t1 where doc2.int > 5; -`doc2`.`int` -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc12`.`int` AS "`doc12`.`int`" from `test`.`t1` where (`test`.`t1`.`doc12`.`int` > 5) +select doc12.int from t1 where doc12.int > 5; +`doc12`.`int` 8 -9 10 -11 -12 -explain extended select doc2.int from t1 use document keys where doc2.int > 5; +explain extended select doc12.int from t1 use document keys where doc12.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc2_int doc2_int 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc12_int doc12_int 9 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2`.`int` AS "`doc2`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`int` > 5) -select doc2.int from t1 use document keys where doc2.int > 5; -`doc2`.`int` -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc12`.`int` AS "`doc12`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc12`.`int` > 5) +select doc12.int from t1 use document keys where doc12.int > 5; +`doc12`.`int` 8 -9 10 -11 -12 -explain extended select count(doc2.int) from t1 use document keys group by doc2.int having doc2.int > 5; +explain extended select count(doc12.int) from t1 use document keys group by doc12.int having doc12.int > 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index NULL doc12_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc12`.`int`) AS `count(doc12.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`int` having (`test`.`t1`.`doc12`.`int` > 5) +select count(doc12.int) from t1 use document keys group by doc12.int having doc12.int > 5; +count(doc12.int) +1 +1 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int > 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 41.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` > 5) +select doc11.string, doc11.int from t1 use document keys where doc11.int > 5; +`doc11`.`string` `doc11`.`int` +false 44444 +NULL 7.777 +hhh 8 + 10 +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int >= 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` >= 5) +select doc11.string, doc11.int from t1 use document keys where doc11.int >= 5; +`doc11`.`string` `doc11`.`int` +false 44444 +eee 5 +NULL 7.777 +hhh 8 + 10 +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int > 13; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` > 13) +select doc11.string, doc11.int from t1 use document keys where doc11.int > 13; +`doc11`.`string` `doc11`.`int` +false 44444 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int < 9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 41.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` < 9) +select doc11.string, doc11.int from t1 use document keys where doc11.int < 9; +`doc11`.`string` `doc11`.`int` +2.2 true +true 3 +eee 5 +NULL 7.777 +hhh 8 +12 false +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int <= 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` <= 5) +select doc11.string, doc11.int from t1 use document keys where doc11.int <= 5; +`doc11`.`string` `doc11`.`int` +2.2 true +true 3 +eee 5 +12 false +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int < 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` < 1) +select doc11.string, doc11.int from t1 use document keys where doc11.int < 1; +`doc11`.`string` `doc11`.`int` +12 false +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int > 2 and doc11.int < 12; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 41.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` > 2) and (`test`.`t1`.`doc11`.`int` < 12)) +select doc11.string, doc11.int from t1 use document keys where doc11.int > 2 and doc11.int < 12; +`doc11`.`string` `doc11`.`int` +true 3 +eee 5 +NULL 7.777 +hhh 8 + 10 +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int >= 5 and doc11.int <= 9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` >= 5) and (`test`.`t1`.`doc11`.`int` <= 9)) +select doc11.string, doc11.int from t1 use document keys where doc11.int >= 5 and doc11.int <= 9; +`doc11`.`string` `doc11`.`int` +eee 5 +NULL 7.777 +hhh 8 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int > 0 and doc11.int < 130; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` > 0) and (`test`.`t1`.`doc11`.`int` < 130)) +select doc11.string, doc11.int from t1 use document keys where doc11.int > 0 and doc11.int < 130; +`doc11`.`string` `doc11`.`int` +2.2 true +true 3 +eee 5 +NULL 7.777 +hhh 8 + 10 +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int between 8 and 9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` between 8 and 9) +select doc11.string, doc11.int from t1 use document keys where doc11.int between 5 and 9; +`doc11`.`string` `doc11`.`int` +eee 5 +NULL 7.777 +hhh 8 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int between 5 and 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 41.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` between 5 and 15) +select doc11.string, doc11.int from t1 use document keys where doc11.int between 5 and 15; +`doc11`.`string` `doc11`.`int` +eee 5 +NULL 7.777 +hhh 8 + 10 +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not between 8 and 9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 58.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not between 8 and 9) +select doc11.string, doc11.int from t1 use document keys where doc11.int not between 8 and 9; +`doc11`.`string` `doc11`.`int` +2.2 true +true 3 +false 44444 +eee 5 +NULL 7.777 + 10 +k 11.111 +12 false +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not between 2 and 12; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not between 2 and 12) +select doc11.string, doc11.int from t1 use document keys where doc11.int not between 2 and 12; +`doc11`.`string` `doc11`.`int` +12 false +2.2 true +false 44444 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not between 5 and 130; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 25.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not between 5 and 130) +select doc11.string, doc11.int from t1 use document keys where doc11.int not between 5 and 130; +`doc11`.`string` `doc11`.`int` +2.2 true +true 3 +false 44444 +12 false +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int in (8); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 8) +select doc11.string, doc11.int from t1 use document keys where doc11.int in (8); +`doc11`.`string` `doc11`.`int` +hhh 8 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 12); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` in (8,12)) +select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 12); +`doc11`.`string` `doc11`.`int` +hhh 8 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 7, 9, 12); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` in (8,7,9,12)) +select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 7, 9, 12); +`doc11`.`string` `doc11`.`int` +NULL 7.777 +hhh 8 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 100, 0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 25.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` in (8,100,0)) +select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 100, 0); +`doc11`.`string` `doc11`.`int` +hhh 8 +12 false +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not in (8, 7, 9, 12); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 58.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not in (8,7,9,12)) +select doc11.string, doc11.int from t1 use document keys where doc11.int not in (8, 7, 9, 12); +`doc11`.`string` `doc11`.`int` +2.2 true +true 3 +false 44444 +eee 5 + 10 +k 11.111 +12 false +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not in (0, 100, 5, 6, 7, 12, 11, 10); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 75.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` not in (0,100,5,6,7,12,11,10)) +select doc11.string, doc11.int from t1 use document keys where doc11.int not in (0, 100, 5, 6, 7, 12, 11, 10); +`doc11`.`string` `doc11`.`int` +2.2 true +true 3 +false 44444 +hhh 8 +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int >= 11 and doc11.int < 100; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`int` > 3) and (`test`.`t1`.`doc11`.`int` < 5)) or ((`test`.`t1`.`doc11`.`int` >= 11) and (`test`.`t1`.`doc11`.`int` < 100))) +select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int >= 11 and doc11.int < 100; +`doc11`.`string` `doc11`.`int` +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int > 6 and doc11.int < 8 or +doc11.int > 9 and doc11.int < 11 or doc11.int >= 12 and doc11.int <= 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`int` > 3) and (`test`.`t1`.`doc11`.`int` < 5)) or ((`test`.`t1`.`doc11`.`int` > 6) and (`test`.`t1`.`doc11`.`int` < 8)) or ((`test`.`t1`.`doc11`.`int` > 9) and (`test`.`t1`.`doc11`.`int` < 11)) or ((`test`.`t1`.`doc11`.`int` >= 12) and (`test`.`t1`.`doc11`.`int` <= 15))) +select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int > 6 and doc11.int < 8 or +doc11.int > 9 and doc11.int < 11 or doc11.int >= 12 and doc11.int <= 15; +`doc11`.`string` `doc11`.`int` +NULL 7.777 + 10 +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 8 or doc11.int > 5 and doc11.int < 9 or +doc11.int > 7 and doc11.int <= 15 or doc11.int >= 12 and doc11.int < 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 41.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`int` > 3) and (`test`.`t1`.`doc11`.`int` < 8)) or ((`test`.`t1`.`doc11`.`int` > 5) and (`test`.`t1`.`doc11`.`int` < 9)) or ((`test`.`t1`.`doc11`.`int` > 7) and (`test`.`t1`.`doc11`.`int` <= 15)) or ((`test`.`t1`.`doc11`.`int` >= 12) and (`test`.`t1`.`doc11`.`int` < 15))) +select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 8 or doc11.int > 5 and doc11.int < 9 or +doc11.int > 7 and doc11.int <= 15 or doc11.int >= 12 and doc11.int < 15; +`doc11`.`string` `doc11`.`int` +eee 5 +NULL 7.777 +hhh 8 + 10 +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys +where ((doc11.int > 3 and doc11.int < 8) and (doc11.int not between 6 and 9)) or +((doc11.int between 11 and 15) and (doc11.int not in (4, 5))); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`int` > 3) and (`test`.`t1`.`doc11`.`int` < 8) and (`test`.`t1`.`doc11`.`int` not between 6 and 9)) or ((`test`.`t1`.`doc11`.`int` between 11 and 15) and (`test`.`t1`.`doc11`.`int` not in (4,5)))) +select doc11.string, doc11.int from t1 use document keys +where ((doc11.int > 3 and doc11.int < 8) and (doc11.int not between 6 and 9)) or +((doc11.int between 11 and 15) and (doc11.int not in (4, 5))); +`doc11`.`string` `doc11`.`int` +eee 5 +k 11.111 +explain extended select doc11.k1.k2 from t1 where doc11.k1.k2.k3.int > 11; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc2_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc2`.`int`) AS `count(doc2.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`int` having (`test`.`t1`.`doc2`.`int` > 5) -select count(doc2.int) from t1 use document keys group by doc2.int having doc2.int > 5; -count(doc2.int) -1 -1 -1 -1 -1 -1 -1 -explain extended select * from t1 where doc1.int > 5; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`k1`.`k2` AS "`doc11`.`k1`.`k2`" from `test`.`t1` where (`test`.`t1`.`doc11`.`k1`.`k2`.`k3`.`int` > 11) +select doc11.k1.k2 from t1 where doc11.k1.k2.k3.int > 11; +`doc11`.`k1`.`k2` +{"k3":{"int":12}} +explain extended select doc11.k1.k2 from t1 use document keys where doc11.k1.k2.k3.int > 11; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_nested doc11_nested 9 NULL 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` > 5) -select * from t1 where doc1.int > 5; -a b c d doc1 doc2 -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select * from t1 use document keys where doc1.int > 5; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`k1`.`k2` AS "`doc11`.`k1`.`k2`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`k1`.`k2`.`k3`.`int` > 11) +select doc11.k1.k2 from t1 use document keys where doc11.k1.k2.k3.int > 11; +`doc11`.`k1`.`k2` +{"k3":{"int":12}} +select doc11.k1.k2.k3 from t1 use document keys where doc11.k1.k2.k3.int > 11; +`doc11`.`k1`.`k2`.`k3` +{"int":12} +select doc11.k1.k2.k3.int.foo from t1 use document keys where doc11.k1.k2.k3.int > 11; +`doc11`.`k1`.`k2`.`k3`.`int`.`foo` +NULL +explain extended select doc11.k1.k2.k3.int from t1 use document keys where doc11.k1.k2.k3 > 11; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_int NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) -select * from t1 use document keys where doc1.int > 5; -a b c d doc1 doc2 -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select count(*) from t1 use document keys group by doc1.int having doc1.int > 5; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`k1`.`k2`.`k3`.`int` AS "`doc11`.`k1`.`k2`.`k3`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`k1`.`k2`.`k3` > 11) +select doc11.k1.k2.k3.int from t1 use document keys where doc11.k1.k2.k3 > 11; +`doc11`.`k1`.`k2`.`k3`.`int` +FIXME!! +explain extended select count(*) from t1 use document keys group by doc11.int having doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`int` having (`test`.`t1`.`doc1`.`int` > 5) -select count(*) from t1 use document keys group by doc1.int having doc1.int > 5; +Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`int` having (`test`.`t1`.`doc11`.`int` > 5) +select count(*) from t1 use document keys group by doc11.int having doc11.int > 5; count(*) 1 1 1 1 1 -1 -1 -explain extended select doc1 from t1 where doc1.int > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` > 5) -select doc1 from t1 where doc1.int > 5; -doc1 -{"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} -{"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} -{"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} -{"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} -{"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} -{"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} -{"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} -explain extended select doc1 from t1 use document keys where doc1.int > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_int NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) -select doc1 from t1 use document keys where doc1.int > 5; -doc1 -{"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} -{"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} -{"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} -{"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} -{"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} -{"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} -{"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} -explain extended select count(doc1) from t1 use document keys group by doc1.int having doc1.int > 5; +FIXME!! +explain extended select count(doc11) from t1 use document keys group by doc11.int having doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`) AS `count(doc1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`int` having (`test`.`t1`.`doc1`.`int` > 5) -select count(doc1) from t1 use document keys group by doc1.int having doc1.int > 5; -count(doc1) -1 -1 +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`) AS `count(doc11)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`int` having (`test`.`t1`.`doc11`.`int` > 5) +select count(doc11) from t1 use document keys group by doc11.int having doc11.int > 5; +count(doc11) 1 1 1 1 1 -explain extended select doc1.double from t1 where doc1.int > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` where (`test`.`t1`.`doc1`.`int` > 5) -select doc1.double from t1 where doc1.int > 5; -`doc1`.`double` -6.6 -7.7 -8.8 -9.9 -10.1 -11.11 -12.12 -explain extended select doc1.double from t1 use document keys where doc1.int > 5; +FIXME!! +explain extended select sum(doc11.double) from t1 use document keys group by doc11.int having doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_int NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) -select doc1.double from t1 use document keys where doc1.int > 5; -`doc1`.`double` -6.6 -7.7 +Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc11`.`double`) AS `sum(doc11.double)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`int` having (`test`.`t1`.`doc11`.`int` > 5) +select sum(doc11.double) from t1 use document keys group by doc11.int having doc11.int > 5; +sum(doc11.double) +0 8.8 -9.9 10.1 -11.11 -12.12 -explain extended select sum(doc1.double) from t1 use document keys group by doc1.int having doc1.int > 5; +1 +NULL +FIXME!! +explain extended select count(*) from t1 use document keys group by doc12.int having doc12.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort +1 SIMPLE t1 index NULL doc12_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc1`.`double`) AS `sum(doc1.double)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`int` having (`test`.`t1`.`doc1`.`int` > 5) -select sum(doc1.double) from t1 use document keys group by doc1.int having doc1.int > 5; -sum(doc1.double) -6.6 -7.7 -8.8 -9.9 -10.1 -11.11 -12.12 -explain extended select * from t1 where doc2.int > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc2`.`int` > 5) -select * from t1 where doc2.int > 5; -a b c d doc1 doc2 -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select * from t1 use document keys where doc2.int > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc2_int NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`int` > 5) -select * from t1 use document keys where doc2.int > 5; -a b c d doc1 doc2 -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select count(*) from t1 use document keys group by doc2.int having doc2.int > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc2_int 9 NULL 12 100.00 Using index; Using temporary; Using filesort -Warnings: -Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`int` having (`test`.`t1`.`doc2`.`int` > 5) -select count(*) from t1 use document keys group by doc2.int having doc2.int > 5; +Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`int` having (`test`.`t1`.`doc12`.`int` > 5) +select count(*) from t1 use document keys group by doc12.int having doc12.int > 5; count(*) 1 1 +FIXME!! +explain extended select count(doc12) from t1 use document keys group by doc12.int having doc12.int > 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc12`) AS `count(doc12)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`int` having (`test`.`t1`.`doc12`.`int` > 5) +select count(doc12) from t1 use document keys group by doc12.int having doc12.int > 5; +count(doc12) 1 1 -1 -1 -1 -explain extended select doc2 from t1 where doc2.int > 5; +FIXME!! +explain extended select sum(doc12.double) from t1 use document keys group by doc12.int having doc12.int > 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc12`.`double`) AS `sum(doc12.double)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`int` having (`test`.`t1`.`doc12`.`int` > 5) +select sum(doc12.double) from t1 use document keys group by doc12.int having doc12.int > 5; +sum(doc12.double) +8.8 +10.1 +explain extended select a1 from t1 where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc2`.`int` > 5) -select doc2 from t1 where doc2.int > 5; -doc2 -{"int":6,"double":6.6} -{"int":7,"double":7.7} -{"int":8,"double":8.8} -{"int":9,"double":9.9} -{"int":10,"double":10.1} -{"int":11,"double":11.11} -{"int":12,"double":12.12} -explain extended select doc2 from t1 use document keys where doc2.int > 5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`double` > 5.5) +select a1 from t1 where doc11.double > 5.5; +a1 +8 +10 +explain extended select a1 from t1 use document keys where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc2_int NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`int` > 5) -select doc2 from t1 use document keys where doc2.int > 5; -doc2 -{"int":6,"double":6.6} -{"int":7,"double":7.7} -{"int":8,"double":8.8} -{"int":9,"double":9.9} -{"int":10,"double":10.1} -{"int":11,"double":11.11} -{"int":12,"double":12.12} -explain extended select count(doc2) from t1 use document keys group by doc2.int having doc2.int > 5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 5.5) +select a1 from t1 use document keys where doc11.double > 5.5; +a1 +8 +10 +explain extended select sum(a1) from t1 use document keys group by doc11.double having doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc2`) AS `count(doc2)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`int` having (`test`.`t1`.`doc2`.`int` > 5) -select count(doc2) from t1 use document keys group by doc2.int having doc2.int > 5; -count(doc2) -1 -1 -1 -1 -1 -1 -1 -explain extended select doc2.double from t1 where doc2.int > 5; +Note 1003 /* select#1 */ select sum(`test`.`t1`.`a1`) AS `sum(a1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`double` having (`test`.`t1`.`doc11`.`double` > 5.5) +select sum(a1) from t1 use document keys group by doc11.double having doc11.double > 5.5; +sum(a1) +8 +10 +explain extended select doc11.double from t1 where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2`.`double` AS "`doc2`.`double`" from `test`.`t1` where (`test`.`t1`.`doc2`.`int` > 5) -select doc2.double from t1 where doc2.int > 5; -`doc2`.`double` -6.6 -7.7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` where (`test`.`t1`.`doc11`.`double` > 5.5) +select doc11.double from t1 where doc11.double > 5.5; +`doc11`.`double` 8.8 -9.9 10.1 -11.11 -12.12 -explain extended select doc2.double from t1 use document keys where doc2.int > 5; +explain extended select doc11.double from t1 use document keys where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc2_int NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2`.`double` AS "`doc2`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`int` > 5) -select doc2.double from t1 use document keys where doc2.int > 5; -`doc2`.`double` -6.6 -7.7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 5.5) +select doc11.double from t1 use document keys where doc11.double > 5.5; +`doc11`.`double` 8.8 -9.9 10.1 -11.11 -12.12 -explain extended select sum(doc2.double) from t1 use document keys group by doc2.int having doc2.int > 5; +explain extended select sum(doc11.double) from t1 use document keys group by doc11.double having doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc2`.`double`) AS `sum(doc2.double)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`int` having (`test`.`t1`.`doc2`.`int` > 5) -select sum(doc2.double) from t1 use document keys group by doc2.int having doc2.int > 5; -sum(doc2.double) -6.6 -7.7 +Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc11`.`double`) AS `sum(doc11.double)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`double` having (`test`.`t1`.`doc11`.`double` > 5.5) +select sum(doc11.double) from t1 use document keys group by doc11.double having doc11.double > 5.5; +sum(doc11.double) 8.8 -9.9 10.1 -11.11 -12.12 -explain extended select doc1.k1.k2 from t1 where doc1.k1.k2.k3.int > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`k1`.`k2` AS "`doc1`.`k1`.`k2`" from `test`.`t1` where (`test`.`t1`.`doc1`.`k1`.`k2`.`k3`.`int` > 5) -select doc1.k1.k2 from t1 where doc1.k1.k2.k3.int > 5; -`doc1`.`k1`.`k2` -{"k3":{"int":6}} -{"k3":{"int":7}} -{"k3":{"int":8}} -{"k3":{"int":9}} -{"k3":{"int":10}} -{"k3":{"int":11}} -{"k3":{"int":12}} -explain extended select doc1.k1.k2 from t1 use document keys where doc1.k1.k2.k3.int > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_nested NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`k1`.`k2` AS "`doc1`.`k1`.`k2`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`k1`.`k2`.`k3`.`int` > 5) -select doc1.k1.k2 from t1 use document keys where doc1.k1.k2.k3.int > 5; -`doc1`.`k1`.`k2` -{"k3":{"int":6}} -{"k3":{"int":7}} -{"k3":{"int":8}} -{"k3":{"int":9}} -{"k3":{"int":10}} -{"k3":{"int":11}} -{"k3":{"int":12}} -select doc1.k1.k2.k3 from t1 use document keys where doc1.k1.k2.k3.int > 5; -`doc1`.`k1`.`k2`.`k3` -{"int":6} -{"int":7} -{"int":8} -{"int":9} -{"int":10} -{"int":11} -{"int":12} -select doc1.k1.k2.k3.int.foo from t1 use document keys where doc1.k1.k2.k3.int > 5; -`doc1`.`k1`.`k2`.`k3`.`int`.`foo` -NULL -NULL -NULL -NULL -NULL -NULL -NULL -explain extended select doc1.k1.k2.k3.int from t1 use document keys where doc1.k1.k2.k3 > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`k1`.`k2`.`k3`.`int` AS "`doc1`.`k1`.`k2`.`k3`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`k1`.`k2`.`k3` > 5) -select doc1.k1.k2.k3.int from t1 use document keys where doc1.k1.k2.k3 > 5; -`doc1`.`k1`.`k2`.`k3`.`int` -explain extended select a from t1 where doc1.double > 5.5; +explain extended select a1 from t1 where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc1`.`double` > 5.5) -select a from t1 where doc1.double > 5.5; -a -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc12`.`double` > 5.5) +select a1 from t1 where doc12.double > 5.5; +a1 8 -9 10 11 -12 -explain extended select a from t1 use document keys where doc1.double > 5.5; +explain extended select a1 from t1 use document keys where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_double doc1_double 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc12_double doc12_double 9 NULL 3 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`double` > 5.5) -select a from t1 use document keys where doc1.double > 5.5; -a -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc12`.`double` > 5.5) +select a1 from t1 use document keys where doc12.double > 5.5; +a1 8 -9 10 11 -12 -explain extended select sum(a) from t1 use document keys group by doc1.double having doc1.double > 5.5; +explain extended select count(a1) from t1 use document keys group by doc12.double having doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc12_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select sum(`test`.`t1`.`a`) AS `sum(a)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`double` having (`test`.`t1`.`doc1`.`double` > 5.5) -select sum(a) from t1 use document keys group by doc1.double having doc1.double > 5.5; -sum(a) -6 -7 -8 -9 -10 -11 -12 -explain extended select doc1.double from t1 where doc1.double > 5.5; +Note 1003 /* select#1 */ select count(`test`.`t1`.`a1`) AS `count(a1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`double` having (`test`.`t1`.`doc12`.`double` > 5.5) +select count(a1) from t1 use document keys group by doc12.double having doc12.double > 5.5; +count(a1) +1 +1 +1 +explain extended select doc12.double from t1 where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` where (`test`.`t1`.`doc1`.`double` > 5.5) -select doc1.double from t1 where doc1.double > 5.5; -`doc1`.`double` -6.6 -7.7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc12`.`double` AS "`doc12`.`double`" from `test`.`t1` where (`test`.`t1`.`doc12`.`double` > 5.5) +select doc12.double from t1 where doc12.double > 5.5; +`doc12`.`double` 8.8 -9.9 10.1 11.11 -12.12 -explain extended select doc1.double from t1 use document keys where doc1.double > 5.5; +explain extended select doc12.double from t1 use document keys where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_double doc1_double 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc12_double doc12_double 9 NULL 3 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`double` > 5.5) -select doc1.double from t1 use document keys where doc1.double > 5.5; -`doc1`.`double` -6.6 -7.7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc12`.`double` AS "`doc12`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc12`.`double` > 5.5) +select doc12.double from t1 use document keys where doc12.double > 5.5; +`doc12`.`double` 8.8 -9.9 10.1 11.11 -12.12 -explain extended select sum(doc1.double) from t1 use document keys group by doc1.double having doc1.double > 5.5; +explain extended select count(doc12.double) from t1 use document keys group by doc12.double having doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc12_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc1`.`double`) AS `sum(doc1.double)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`double` having (`test`.`t1`.`doc1`.`double` > 5.5) -select sum(doc1.double) from t1 use document keys group by doc1.double having doc1.double > 5.5; -sum(doc1.double) -6.6 -7.7 -8.8 -9.9 -10.1 -11.11 -12.12 -explain extended select a from t1 where doc2.double > 5.5; +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc12`.`double`) AS `count(doc12.double)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`double` having (`test`.`t1`.`doc12`.`double` > 5.5) +select count(doc12.double) from t1 use document keys group by doc12.double having doc12.double > 5.5; +count(doc12.double) +1 +1 +1 +explain extended select a1 from t1 where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc2`.`double` > 5.5) -select a from t1 where doc2.double > 5.5; -a -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`double` > 5.5) +select a1 from t1 where doc11.double > 5.5; +a1 8 -9 10 -11 -12 -explain extended select a from t1 use document keys where doc2.double > 5.5; +explain extended select a1 from t1 use document keys where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc2_double doc2_double 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`double` > 5.5) -select a from t1 use document keys where doc2.double > 5.5; -a -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 5.5) +select a1 from t1 use document keys where doc11.double > 5.5; +a1 8 -9 10 +explain extended select doc11.double from t1 use document keys where doc11.double >= 5.5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` >= 5.5) +select doc11.double from t1 use document keys where doc11.double >= 5.5; +`doc11`.`double` +5.5 +8.8 +10.1 +explain extended select a1 from t1 use document keys where doc11.double > 13.3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 13.3) +select a1 from t1 use document keys where doc11.double > 13.3; +a1 +explain extended select a1, doc11.double from t1 use document keys where doc11.double < 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 7 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` < 9.9) +select a1, doc11.double from t1 use document keys where doc11.double < 9.9; +a1 `doc11`.`double` +7 0 +12 0 +1 1 +11 1 +2 2.2 +3 3.3 +5 5.5 +8 8.8 +explain extended select doc11.double, a1 from t1 use document keys where doc11.double <= 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 8 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` <= 9.9) +select doc11.double, a1 from t1 use document keys where doc11.double <= 9.9; +`doc11`.`double` a1 +0 7 +0 12 +1 1 +1 11 +2.2 2 +3.3 3 +5.5 5 +8.8 8 +explain extended select doc11.double from t1 use document keys where doc11.double < 0.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` < 0.1) +select doc11.double from t1 use document keys where doc11.double < 0.1; +`doc11`.`double` +0 +0 +explain extended select a1, doc11.double from t1 use document keys where doc11.double > 5.5 and doc11.double < 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 1 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` > 5.5) and (`test`.`t1`.`doc11`.`double` < 9.9)) +select a1, doc11.double from t1 use document keys where doc11.double > 5.5 and doc11.double < 9.9; +a1 `doc11`.`double` +8 8.8 +explain extended select a1 from t1 use document keys where doc11.double >= 5.5 and doc11.double <= 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` >= 5.5) and (`test`.`t1`.`doc11`.`double` <= 9.9)) +select a1 from t1 use document keys where doc11.double >= 5.5 and doc11.double <= 9.9; +a1 +5 +8 +explain extended select a1 from t1 use document keys where doc11.double > 0 and doc11.double < 130; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 6 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` > 0) and (`test`.`t1`.`doc11`.`double` < 130)) +select a1 from t1 use document keys where doc11.double > 0 and doc11.double < 130; +a1 +1 11 -12 -explain extended select count(a) from t1 use document keys group by doc2.double having doc2.double > 5.5; +2 +3 +5 +8 +10 +explain extended select a1, doc11.double from t1 use document keys where doc11.double between 5.5 and 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` between 5.5 and 9.9) +select a1, doc11.double from t1 use document keys where doc11.double between 5.5 and 9.9; +a1 `doc11`.`double` +5 5.5 +8 8.8 +explain extended select doc11.double from t1 use document keys where doc11.double between 5.5 and 15.5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` between 5.5 and 15.5) +select doc11.double from t1 use document keys where doc11.double between 5.5 and 15.5; +`doc11`.`double` +5.5 +8.8 +10.1 +explain extended select a1, doc11.double from t1 use document keys where doc11.double not between 5.5 and 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 6 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` not between 5.5 and 9.9) +select a1, doc11.double from t1 use document keys where doc11.double not between 5.5 and 9.9; +a1 `doc11`.`double` +7 0 +12 0 +1 1 +11 1 +2 2.2 +3 3.3 +10 10.1 +explain extended select a1, doc11.double from t1 use document keys where doc11.double not between 5.5 and 130; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 6 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` not between 5.5 and 130) +select a1, doc11.double from t1 use document keys where doc11.double not between 5.5 and 130; +a1 `doc11`.`double` +7 0 +12 0 +1 1 +11 1 +2 2.2 +3 3.3 +explain extended select a1, doc11.double from t1 use document keys where doc11.double in (3.3, 8.8, 4.4); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 3 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` in (3.3,8.8,4.4)) +select a1, doc11.double from t1 use document keys where doc11.double in (3.3, 8.8, 4.4); +a1 `doc11`.`double` +3 3.3 +8 8.8 +explain extended select a1, doc11.double from t1 use document keys where doc11.double in (5.5, 100, 0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 4 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` in (5.5,100,0)) +select a1, doc11.double from t1 use document keys where doc11.double in (5.5, 100, 0); +a1 `doc11`.`double` +7 0 +12 0 +5 5.5 +explain extended select a1, doc11.double from t1 use document keys where doc11.double not in (5.5, 7.7, 9.9, 12.12); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc2_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 9 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`a`) AS `count(a)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`double` having (`test`.`t1`.`doc2`.`double` > 5.5) -select count(a) from t1 use document keys group by doc2.double having doc2.double > 5.5; -count(a) -1 -1 -1 -1 -1 -1 -1 -explain extended select doc2.double from t1 where doc2.double > 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` not in (5.5,7.7,9.9,12.12)) +select a1, doc11.double from t1 use document keys where doc11.double not in (5.5, 7.7, 9.9, 12.12); +a1 `doc11`.`double` +7 0 +12 0 +1 1 +11 1 +2 2.2 +3 3.3 +8 8.8 +10 10.1 +explain extended select a1, doc11.double from t1 use document keys where doc11.double not in (0, 100, 5.5, 6.6, 7.7, 12.12, 11.11, 10.1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 11 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` not in (0,100,5.5,6.6,7.7,12.12,11.11,10.1)) +select a1, doc11.double from t1 use document keys where doc11.double not in (0, 100, 5.5, 6.6, 7.7, 12.12, 11.11, 10.1); +a1 `doc11`.`double` +1 1 +11 1 +2 2.2 +3 3.3 +8 8.8 +explain extended select doc11.double from t1 use document keys +where doc11.double > 3.3 and doc11.double < 5.5 or doc11.double > 6.6 and doc11.double < 8.8 or +doc11.double > 9.9 and doc11.double < 11.11 or doc11.double >= 12.12 and doc11.double <= 15.15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 4 100.00 Using where; Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`double` > 3.3) and (`test`.`t1`.`doc11`.`double` < 5.5)) or ((`test`.`t1`.`doc11`.`double` > 6.6) and (`test`.`t1`.`doc11`.`double` < 8.8)) or ((`test`.`t1`.`doc11`.`double` > 9.9) and (`test`.`t1`.`doc11`.`double` < 11.11)) or ((`test`.`t1`.`doc11`.`double` >= 12.12) and (`test`.`t1`.`doc11`.`double` <= 15.15))) +select doc11.double from t1 use document keys +where doc11.double > 3.3 and doc11.double < 5.5 or doc11.double > 6.6 and doc11.double < 8.8 or +doc11.double > 9.9 and doc11.double < 11.11 or doc11.double >= 12.12 and doc11.double <= 15.15; +`doc11`.`double` +10.1 +explain extended select doc11.double from t1 use document keys +where doc11.double > 3.3 and doc11.double < 8.8 or doc11.double > 5.5 and doc11.double < 9.9 or +doc11.double > 7.7 and doc11.double <= 15.15 or doc11.double >= 12.12 and doc11.double < 15.15; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 3 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2`.`double` AS "`doc2`.`double`" from `test`.`t1` where (`test`.`t1`.`doc2`.`double` > 5.5) -select doc2.double from t1 where doc2.double > 5.5; -`doc2`.`double` -6.6 -7.7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`double` > 3.3) and (`test`.`t1`.`doc11`.`double` < 8.8)) or ((`test`.`t1`.`doc11`.`double` > 5.5) and (`test`.`t1`.`doc11`.`double` < 9.9)) or ((`test`.`t1`.`doc11`.`double` > 7.7) and (`test`.`t1`.`doc11`.`double` <= 15.15)) or ((`test`.`t1`.`doc11`.`double` >= 12.12) and (`test`.`t1`.`doc11`.`double` < 15.15))) +select doc11.double from t1 use document keys +where doc11.double > 3.3 and doc11.double < 8.8 or doc11.double > 5.5 and doc11.double < 9.9 or +doc11.double > 7.7 and doc11.double <= 15.15 or doc11.double >= 12.12 and doc11.double < 15.15; +`doc11`.`double` +5.5 8.8 -9.9 10.1 -11.11 -12.12 -explain extended select doc2.double from t1 use document keys where doc2.double > 5.5; +explain extended select doc11.double from t1 use document keys +where ((doc11.double > 4.4 and doc11.double < 10.10) and (doc11.double not between 8.8 and 9.9)) or +((doc11.double between 3.3 and 15.15) and (doc11.double not in (4.4, 5.5))); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc2_double doc2_double 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 4 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2`.`double` AS "`doc2`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`double` > 5.5) -select doc2.double from t1 use document keys where doc2.double > 5.5; -`doc2`.`double` -6.6 -7.7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`double` > 4.4) and (`test`.`t1`.`doc11`.`double` < 10.10) and (`test`.`t1`.`doc11`.`double` not between 8.8 and 9.9)) or ((`test`.`t1`.`doc11`.`double` between 3.3 and 15.15) and (`test`.`t1`.`doc11`.`double` not in (4.4,5.5)))) +select doc11.double from t1 use document keys +where ((doc11.double > 4.4 and doc11.double < 10.10) and (doc11.double not between 8.8 and 9.9)) or +((doc11.double between 3.3 and 15.15) and (doc11.double not in (4.4, 5.5))); +`doc11`.`double` +3.3 +5.5 8.8 -9.9 10.1 -11.11 -12.12 -explain extended select count(doc2.double) from t1 use document keys group by doc2.double having doc2.double > 5.5; +explain extended select a1, doc11.int from t1 where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc2_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc2`.`double`) AS `count(doc2.double)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`double` having (`test`.`t1`.`doc2`.`double` > 5.5) -select count(doc2.double) from t1 use document keys group by doc2.double having doc2.double > 5.5; -count(doc2.double) -1 -1 -1 -1 -1 -1 -1 -explain extended select * from t1 where doc1.double > 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`doc11`.`double` > 5.5) +select a1, doc11.int from t1 where doc11.double > 5.5; +a1 `doc11`.`int` +8 8 +10 10 +explain extended select a1, doc11.int from t1 use document keys where doc11.double > 5.5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 5.5) +select a1, doc11.int from t1 use document keys where doc11.double > 5.5; +a1 `doc11`.`int` +8 8 +10 10 +explain extended select doc11.double, doc11.int from t1 use document keys where doc11.double >= 5.5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` >= 5.5) +select doc11.double, doc11.int from t1 use document keys where doc11.double >= 5.5; +`doc11`.`double` `doc11`.`int` +5.5 5 +8.8 8 +10.1 10 +explain extended select a1, doc11.int from t1 use document keys where doc11.double > 13.3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 13.3) +select a1, doc11.int from t1 use document keys where doc11.double > 13.3; +a1 `doc11`.`int` +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double < 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 58.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` < 9.9) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double < 9.9; +a1 `doc11`.`double` `doc11`.`int` +1 1 NULL +2 2.2 true +3 3.3 3 +5 5.5 5 +7 false 7.777 +8 8.8 8 +11 true 11.111 +12 false false +explain extended select doc11.double, a1, doc11.int from t1 use document keys where doc11.double <= 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 66.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` <= 9.9) +select doc11.double, a1, doc11.int from t1 use document keys where doc11.double <= 9.9; +`doc11`.`double` a1 `doc11`.`int` +1 1 NULL +2.2 2 true +3.3 3 3 +5.5 5 5 +false 7 7.777 +8.8 8 8 +true 11 11.111 +false 12 false +explain extended select doc11.double, doc11.int from t1 use document keys where doc11.double < 0.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` < 0.1) +select doc11.double, doc11.int from t1 use document keys where doc11.double < 0.1; +`doc11`.`double` `doc11`.`int` +false 7.777 +false false +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double > 5.5 and doc11.double < 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` > 5.5) and (`test`.`t1`.`doc11`.`double` < 9.9)) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double > 5.5 and doc11.double < 9.9; +a1 `doc11`.`double` `doc11`.`int` +8 8.8 8 +explain extended select a1, doc11.int from t1 use document keys where doc11.double >= 5.5 and doc11.double <= 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` >= 5.5) and (`test`.`t1`.`doc11`.`double` <= 9.9)) +select a1, doc11.int from t1 use document keys where doc11.double >= 5.5 and doc11.double <= 9.9; +a1 `doc11`.`int` +5 5 +8 8 +explain extended select a1, doc11.int from t1 use document keys where doc11.double > 0 and doc11.double < 130; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` > 0) and (`test`.`t1`.`doc11`.`double` < 130)) +select a1, doc11.int from t1 use document keys where doc11.double > 0 and doc11.double < 130; +a1 `doc11`.`int` +1 NULL +2 true +3 3 +5 5 +8 8 +10 10 +11 11.111 +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double between 5.5 and 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` between 5.5 and 9.9) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double between 5.5 and 9.9; +a1 `doc11`.`double` `doc11`.`int` +5 5.5 5 +8 8.8 8 +explain extended select doc11.double, doc11.int from t1 use document keys where doc11.double between 5.5 and 15.5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` between 5.5 and 15.5) +select doc11.double, doc11.int from t1 use document keys where doc11.double between 5.5 and 15.5; +`doc11`.`double` `doc11`.`int` +5.5 5 +8.8 8 +10.1 10 +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not between 5.5 and 9.9; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` not between 5.5 and 9.9) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not between 5.5 and 9.9; +a1 `doc11`.`double` `doc11`.`int` +1 1 NULL +2 2.2 true +3 3.3 3 +7 false 7.777 +10 10.1 10 +11 true 11.111 +12 false false +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not between 5.5 and 130; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` not between 5.5 and 130) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not between 5.5 and 130; +a1 `doc11`.`double` `doc11`.`int` +1 1 NULL +2 2.2 true +3 3.3 3 +7 false 7.777 +11 true 11.111 +12 false false +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double in (5.5, 7.7, 9.9, 12.12); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` in (5.5,7.7,9.9,12.12)) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double in (5.5, 7.7, 9.9, 12.12); +a1 `doc11`.`double` `doc11`.`int` +5 5.5 5 +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double in (5.5, 100, 0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` in (5.5,100,0)) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double in (5.5, 100, 0); +a1 `doc11`.`double` `doc11`.`int` +5 5.5 5 +7 false 7.777 +12 false false +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not in (5.5, 7.7, 9.9, 12.12); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 75.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` not in (5.5,7.7,9.9,12.12)) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not in (5.5, 7.7, 9.9, 12.12); +a1 `doc11`.`double` `doc11`.`int` +1 1 NULL +2 2.2 true +3 3.3 3 +7 false 7.777 +8 8.8 8 +10 10.1 10 +11 true 11.111 +12 false false +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not in (0, 100, 5.5, 6.6, 7.7, 12.12, 11.11, 10.1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 91.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` not in (0,100,5.5,6.6,7.7,12.12,11.11,10.1)) +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not in (0, 100, 5.5, 6.6, 7.7, 12.12, 11.11, 10.1); +a1 `doc11`.`double` `doc11`.`int` +1 1 NULL +2 2.2 true +3 3.3 3 +8 8.8 8 +11 true 11.111 +explain extended select doc11.double, doc11.int from t1 use document keys +where doc11.double > 3.3 and doc11.double < 5.5 or doc11.double > 6.6 and doc11.double < 8.8 or +doc11.double > 9.9 and doc11.double < 11.11 or doc11.double >= 12.12 and doc11.double <= 15.15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`double` > 3.3) and (`test`.`t1`.`doc11`.`double` < 5.5)) or ((`test`.`t1`.`doc11`.`double` > 6.6) and (`test`.`t1`.`doc11`.`double` < 8.8)) or ((`test`.`t1`.`doc11`.`double` > 9.9) and (`test`.`t1`.`doc11`.`double` < 11.11)) or ((`test`.`t1`.`doc11`.`double` >= 12.12) and (`test`.`t1`.`doc11`.`double` <= 15.15))) +select doc11.double, doc11.int from t1 use document keys +where doc11.double > 3.3 and doc11.double < 5.5 or doc11.double > 6.6 and doc11.double < 8.8 or +doc11.double > 9.9 and doc11.double < 11.11 or doc11.double >= 12.12 and doc11.double <= 15.15; +`doc11`.`double` `doc11`.`int` +10.1 10 +explain extended select doc11.double, doc11.int from t1 use document keys +where doc11.double > 3.3 and doc11.double < 8.8 or doc11.double > 5.5 and doc11.double < 9.9 or +doc11.double > 7.7 and doc11.double <= 15.15 or doc11.double >= 12.12 and doc11.double < 15.15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`double` > 3.3) and (`test`.`t1`.`doc11`.`double` < 8.8)) or ((`test`.`t1`.`doc11`.`double` > 5.5) and (`test`.`t1`.`doc11`.`double` < 9.9)) or ((`test`.`t1`.`doc11`.`double` > 7.7) and (`test`.`t1`.`doc11`.`double` <= 15.15)) or ((`test`.`t1`.`doc11`.`double` >= 12.12) and (`test`.`t1`.`doc11`.`double` < 15.15))) +select doc11.double, doc11.int from t1 use document keys +where doc11.double > 3.3 and doc11.double < 8.8 or doc11.double > 5.5 and doc11.double < 9.9 or +doc11.double > 7.7 and doc11.double <= 15.15 or doc11.double >= 12.12 and doc11.double < 15.15; +`doc11`.`double` `doc11`.`int` +5.5 5 +8.8 8 +10.1 10 +explain extended select doc11.double, doc11.int from t1 use document keys +where ((doc11.double > 4.4 and doc11.double < 10.10) and (doc11.double not between 8.8 and 9.9)) or +((doc11.double between 3.3 and 15.15) and (doc11.double not in (4.4, 5.5))); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`double` > 4.4) and (`test`.`t1`.`doc11`.`double` < 10.10) and (`test`.`t1`.`doc11`.`double` not between 8.8 and 9.9)) or ((`test`.`t1`.`doc11`.`double` between 3.3 and 15.15) and (`test`.`t1`.`doc11`.`double` not in (4.4,5.5)))) +select doc11.double, doc11.int from t1 use document keys +where ((doc11.double > 4.4 and doc11.double < 10.10) and (doc11.double not between 8.8 and 9.9)) or +((doc11.double between 3.3 and 15.15) and (doc11.double not in (4.4, 5.5))); +`doc11`.`double` `doc11`.`int` +3.3 3 +5.5 5 +8.8 8 +10.1 10 +explain extended select * from t1 where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc1`.`double` > 5.5) -select * from t1 where doc1.double > 5.5; -a b c d doc1 doc2 -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select * from t1 use document keys where doc1.double > 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` where (`test`.`t1`.`doc11`.`double` > 5.5) +select * from t1 where doc11.double > 5.5; +a1 b1 c1 d1 doc11 doc12 +8 8 8.8 hhh {"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} +10 10 10.1 jjj {"bool":false,"int":10,"double":"10.1","string":"","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} +explain extended select * from t1 use document keys where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_double NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`double` > 5.5) -select * from t1 use document keys where doc1.double > 5.5; -a b c d doc1 doc2 -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select count(*) from t1 use document keys group by doc1.double having doc1.double > 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 5.5) +select * from t1 use document keys where doc11.double > 5.5; +a1 b1 c1 d1 doc11 doc12 +8 8 8.8 hhh {"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} +10 10 10.1 jjj {"bool":false,"int":10,"double":"10.1","string":"","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} +explain extended select count(*) from t1 use document keys group by doc11.double having doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`double` having (`test`.`t1`.`doc1`.`double` > 5.5) -select count(*) from t1 use document keys group by doc1.double having doc1.double > 5.5; +Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`double` having (`test`.`t1`.`doc11`.`double` > 5.5) +select count(*) from t1 use document keys group by doc11.double having doc11.double > 5.5; count(*) 1 1 -1 -1 -1 -1 -1 -explain extended select doc1 from t1 where doc1.double > 5.5; +explain extended select doc11 from t1 where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` where (`test`.`t1`.`doc1`.`double` > 5.5) -select doc1 from t1 where doc1.double > 5.5; -doc1 -{"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} -{"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} -{"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} -{"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} -{"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} -{"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} -{"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} -explain extended select doc1 from t1 use document keys where doc1.double > 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` where (`test`.`t1`.`doc11`.`double` > 5.5) +select doc11 from t1 where doc11.double > 5.5; +doc11 +{"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} +{"bool":false,"int":10,"double":"10.1","string":"","k1":{"k2":{"k3":{"int":10}}},"id":10} +explain extended select doc11 from t1 use document keys where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_double NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`double` > 5.5) -select doc1 from t1 use document keys where doc1.double > 5.5; -doc1 -{"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} -{"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} -{"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} -{"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} -{"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} -{"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} -{"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} -explain extended select count(doc1) from t1 use document keys group by doc1.double having doc1.double > 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 5.5) +select doc11 from t1 use document keys where doc11.double > 5.5; +doc11 +{"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} +{"bool":false,"int":10,"double":"10.1","string":"","k1":{"k2":{"k3":{"int":10}}},"id":10} +explain extended select count(doc11) from t1 use document keys group by doc11.double having doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`) AS `count(doc1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`double` having (`test`.`t1`.`doc1`.`double` > 5.5) -select count(doc1) from t1 use document keys group by doc1.double having doc1.double > 5.5; -count(doc1) -1 +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`) AS `count(doc11)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`double` having (`test`.`t1`.`doc11`.`double` > 5.5) +select count(doc11) from t1 use document keys group by doc11.double having doc11.double > 5.5; +count(doc11) 1 1 -1 -1 -1 -1 -explain extended select doc1.string from t1 where doc1.double > 5.5; +explain extended select doc11.string from t1 where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`string` AS "`doc1`.`string`" from `test`.`t1` where (`test`.`t1`.`doc1`.`double` > 5.5) -select doc1.string from t1 where doc1.double > 5.5; -`doc1`.`string` -fff -ggg +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` where (`test`.`t1`.`doc11`.`double` > 5.5) +select doc11.string from t1 where doc11.double > 5.5; +`doc11`.`string` hhh -iii -jjj -kkk -lll -explain extended select doc1.string from t1 use document keys where doc1.double > 5.5; + +explain extended select doc11.string from t1 use document keys where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_double NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`string` AS "`doc1`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`double` > 5.5) -select doc1.string from t1 use document keys where doc1.double > 5.5; -`doc1`.`string` -fff -ggg +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 5.5) +select doc11.string from t1 use document keys where doc11.double > 5.5; +`doc11`.`string` hhh -iii -jjj -kkk -lll -explain extended select count(doc1.string) from t1 use document keys group by doc1.double having doc1.double > 5.5; + +explain extended select count(doc11.string) from t1 use document keys group by doc11.double having doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`.`string`) AS `count(doc1.string)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`double` having (`test`.`t1`.`doc1`.`double` > 5.5) -select count(doc1.string) from t1 use document keys group by doc1.double having doc1.double > 5.5; -count(doc1.string) -1 -1 -1 -1 +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`.`string`) AS `count(doc11.string)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`double` having (`test`.`t1`.`doc11`.`double` > 5.5) +select count(doc11.string) from t1 use document keys group by doc11.double having doc11.double > 5.5; +count(doc11.string) 1 1 -1 -explain extended select * from t1 where doc2.double > 5.5; +explain extended select * from t1 where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc2`.`double` > 5.5) -select * from t1 where doc2.double > 5.5; -a b c d doc1 doc2 -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select * from t1 use document keys where doc2.double > 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` where (`test`.`t1`.`doc12`.`double` > 5.5) +select * from t1 where doc12.double > 5.5; +a1 b1 c1 d1 doc11 doc12 +8 8 8.8 hhh {"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} +10 10 10.1 jjj {"bool":false,"int":10,"double":"10.1","string":"","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} +11 11 11.11 kkk {"bool":0,"int":"11.111","double":true,"string":"k","k1":{"k2":{"k3":{"int":11}}},"id":11} {"__t":11,"double":11.11} +explain extended select * from t1 use document keys where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc2_double NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc12_double doc12_double 9 NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`double` > 5.5) -select * from t1 use document keys where doc2.double > 5.5; -a b c d doc1 doc2 -6 6 6.6 fff {"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} {"int":6,"double":6.6} -7 7 7.7 ggg {"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} {"int":7,"double":7.7} -8 8 8.8 hhh {"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} -9 9 9.9 iii {"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} {"int":9,"double":9.9} -10 10 10.1 jjj {"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} -11 11 11.11 kkk {"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} {"int":11,"double":11.11} -12 12 12.12 lll {"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} {"int":12,"double":12.12} -explain extended select count(*) from t1 use document keys group by doc2.double having doc2.double > 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc12`.`double` > 5.5) +select * from t1 use document keys where doc12.double > 5.5; +a1 b1 c1 d1 doc11 doc12 +8 8 8.8 hhh {"bool":123456789,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} {"int":8,"double":8.8} +10 10 10.1 jjj {"bool":false,"int":10,"double":"10.1","string":"","k1":{"k2":{"k3":{"int":10}}},"id":10} {"int":10,"double":10.1} +11 11 11.11 kkk {"bool":0,"int":"11.111","double":true,"string":"k","k1":{"k2":{"k3":{"int":11}}},"id":11} {"__t":11,"double":11.11} +explain extended select count(*) from t1 use document keys group by doc12.double having doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc2_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc12_double 9 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`double` having (`test`.`t1`.`doc2`.`double` > 5.5) -select count(*) from t1 use document keys group by doc2.double having doc2.double > 5.5; +Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`double` having (`test`.`t1`.`doc12`.`double` > 5.5) +select count(*) from t1 use document keys group by doc12.double having doc12.double > 5.5; count(*) 1 1 1 -1 -1 -1 -1 -explain extended select doc2 from t1 where doc2.double > 5.5; +explain extended select doc12 from t1 where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc2`.`double` > 5.5) -select doc2 from t1 where doc2.double > 5.5; -doc2 -{"int":6,"double":6.6} -{"int":7,"double":7.7} +Note 1003 /* select#1 */ select `test`.`t1`.`doc12` AS `doc12` from `test`.`t1` where (`test`.`t1`.`doc12`.`double` > 5.5) +select doc12 from t1 where doc12.double > 5.5; +doc12 {"int":8,"double":8.8} -{"int":9,"double":9.9} {"int":10,"double":10.1} -{"int":11,"double":11.11} -{"int":12,"double":12.12} -explain extended select doc2 from t1 use document keys where doc2.double > 5.5; +{"__t":11,"double":11.11} +explain extended select doc12 from t1 use document keys where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc2_double NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc12_double doc12_double 9 NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`double` > 5.5) -select doc2 from t1 use document keys where doc2.double > 5.5; -doc2 -{"int":6,"double":6.6} -{"int":7,"double":7.7} +Note 1003 /* select#1 */ select `test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc12`.`double` > 5.5) +select doc12 from t1 use document keys where doc12.double > 5.5; +doc12 {"int":8,"double":8.8} -{"int":9,"double":9.9} {"int":10,"double":10.1} -{"int":11,"double":11.11} -{"int":12,"double":12.12} -explain extended select count(doc2) from t1 use document keys group by doc2.double having doc2.double > 5.5; +{"__t":11,"double":11.11} +explain extended select count(doc12) from t1 use document keys group by doc12.double having doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc2`) AS `count(doc2)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`double` having (`test`.`t1`.`doc2`.`double` > 5.5) -select count(doc2) from t1 use document keys group by doc2.double having doc2.double > 5.5; -count(doc2) -1 -1 -1 +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc12`) AS `count(doc12)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`double` having (`test`.`t1`.`doc12`.`double` > 5.5) +select count(doc12) from t1 use document keys group by doc12.double having doc12.double > 5.5; +count(doc12) 1 1 1 -1 -explain extended select doc2.int from t1 where doc2.double > 5.5; +explain extended select doc12.int from t1 where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2`.`int` AS "`doc2`.`int`" from `test`.`t1` where (`test`.`t1`.`doc2`.`double` > 5.5) -select doc2.int from t1 where doc2.double > 5.5; -`doc2`.`int` -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc12`.`int` AS "`doc12`.`int`" from `test`.`t1` where (`test`.`t1`.`doc12`.`double` > 5.5) +select doc12.int from t1 where doc12.double > 5.5; +`doc12`.`int` 8 -9 10 -11 -12 -explain extended select doc2.int from t1 use document keys where doc2.double > 5.5; +NULL +explain extended select doc12.int from t1 use document keys where doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc2_double NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc12_double doc12_double 9 NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc2`.`int` AS "`doc2`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc2`.`double` > 5.5) -select doc2.int from t1 use document keys where doc2.double > 5.5; -`doc2`.`int` -6 -7 +Note 1003 /* select#1 */ select `test`.`t1`.`doc12`.`int` AS "`doc12`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc12`.`double` > 5.5) +select doc12.int from t1 use document keys where doc12.double > 5.5; +`doc12`.`int` 8 -9 10 -11 -12 -explain extended select count(doc2.int) from t1 use document keys group by doc2.double having doc2.double > 5.5; +NULL +explain extended select count(doc12.int) from t1 use document keys group by doc12.double having doc12.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc2`.`int`) AS `count(doc2.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc2`.`double` having (`test`.`t1`.`doc2`.`double` > 5.5) -select count(doc2.int) from t1 use document keys group by doc2.double having doc2.double > 5.5; -count(doc2.int) -1 -1 -1 +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc12`.`int`) AS `count(doc12.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc12`.`double` having (`test`.`t1`.`doc12`.`double` > 5.5) +select count(doc12.int) from t1 use document keys group by doc12.double having doc12.double > 5.5; +count(doc12.int) 1 1 -1 -1 -explain extended select a from t1 where doc1.string = 'eee'; +0 +FIXME!! Inconsistency between Boolean type and String +Boolean values (true/false) will be converted to "1" /"0" when creating a key image (for range optimization), +but it will be converted to "True"/"False" when getting values from document paths for building index keys. +explain extended select a1 from t1 where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc1`.`string` = 'eee') -select a from t1 where doc1.string = 'eee'; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`string` = 'eee') +select a1 from t1 where doc11.string = 'eee'; +a1 5 -explain extended select a from t1 use document keys where doc1.string = 'eee'; +explain extended select a1 from t1 use document keys where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_string doc1_string 101 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_string doc11_string 6 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` = 'eee') -select a from t1 use document keys where doc1.string = 'eee'; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` = 'eee') +select a1 from t1 use document keys where doc11.string = 'eee'; +a1 5 -explain extended select count(a) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +explain extended select count(a1) from t1 use document keys group by doc11.string having doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`a`) AS `count(a)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`string` having (`test`.`t1`.`doc1`.`string` = 'eee') -select count(a) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -count(a) +Note 1003 /* select#1 */ select count(`test`.`t1`.`a1`) AS `count(a1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`string` having (`test`.`t1`.`doc11`.`string` = 'eee') +select count(a1) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +count(a1) 1 -explain extended select doc1.string from t1 where doc1.string = 'eee'; +explain extended select doc11.string from t1 where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`string` AS "`doc1`.`string`" from `test`.`t1` where (`test`.`t1`.`doc1`.`string` = 'eee') -select doc1.string from t1 where doc1.string = 'eee'; -`doc1`.`string` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` where (`test`.`t1`.`doc11`.`string` = 'eee') +select doc11.string from t1 where doc11.string = 'eee'; +`doc11`.`string` eee -explain extended select doc1.string from t1 use document keys where doc1.string = 'eee'; +explain extended select doc11.string from t1 use document keys where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_string doc1_string 101 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_string doc11_string 6 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`string` AS "`doc1`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` = 'eee') -select doc1.string from t1 use document keys where doc1.string = 'eee'; -`doc1`.`string` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` = 'eee') +select doc11.string from t1 use document keys where doc11.string = 'eee'; +`doc11`.`string` eee -explain extended select count(doc1.string) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +explain extended select count(doc11.string) from t1 use document keys group by doc11.string having doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`.`string`) AS `count(doc1.string)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`string` having (`test`.`t1`.`doc1`.`string` = 'eee') -select count(doc1.string) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -count(doc1.string) +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`.`string`) AS `count(doc11.string)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`string` having (`test`.`t1`.`doc11`.`string` = 'eee') +select count(doc11.string) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +count(doc11.string) 1 -explain extended select * from t1 where doc1.string = 'eee'; +explain extended select * from t1 where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc1`.`string` = 'eee') -select * from t1 where doc1.string = 'eee'; -a b c d doc1 doc2 -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -explain extended select * from t1 use document keys where doc1.string = 'eee'; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` where (`test`.`t1`.`doc11`.`string` = 'eee') +select * from t1 where doc11.string = 'eee'; +a1 b1 c1 d1 doc11 doc12 +5 5 5.5 eee {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} +explain extended select * from t1 use document keys where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_string doc1_string 101 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_string doc11_string 6 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` = 'eee') -select * from t1 use document keys where doc1.string = 'eee'; -a b c d doc1 doc2 -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -explain extended select count(*) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` = 'eee') +select * from t1 use document keys where doc11.string = 'eee'; +a1 b1 c1 d1 doc11 doc12 +5 5 5.5 eee {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} +explain extended select count(*) from t1 use document keys group by doc11.string having doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`string` having (`test`.`t1`.`doc1`.`string` = 'eee') -select count(*) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`string` having (`test`.`t1`.`doc11`.`string` = 'eee') +select count(*) from t1 use document keys group by doc11.string having doc11.string = 'eee'; count(*) 1 -explain extended select doc1 from t1 where doc1.string = 'eee'; +explain extended select doc11 from t1 where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` where (`test`.`t1`.`doc1`.`string` = 'eee') -select doc1 from t1 where doc1.string = 'eee'; -doc1 -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select doc1 from t1 use document keys where doc1.string = 'eee'; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` where (`test`.`t1`.`doc11`.`string` = 'eee') +select doc11 from t1 where doc11.string = 'eee'; +doc11 +{"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +explain extended select doc11 from t1 use document keys where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_string doc1_string 101 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_string doc11_string 6 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` = 'eee') -select doc1 from t1 use document keys where doc1.string = 'eee'; -doc1 -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select count(doc1) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` = 'eee') +select doc11 from t1 use document keys where doc11.string = 'eee'; +doc11 +{"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +explain extended select count(doc11) from t1 use document keys group by doc11.string having doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`doc1`) AS `count(doc1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`string` having (`test`.`t1`.`doc1`.`string` = 'eee') -select count(doc1) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -count(doc1) +Note 1003 /* select#1 */ select count(`test`.`t1`.`doc11`) AS `count(doc11)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`string` having (`test`.`t1`.`doc11`.`string` = 'eee') +select count(doc11) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +count(doc11) 1 -explain extended select doc1.int from t1 where doc1.string = 'eee'; +explain extended select doc11.int from t1 where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where (`test`.`t1`.`doc1`.`string` = 'eee') -select doc1.int from t1 where doc1.string = 'eee'; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`doc11`.`string` = 'eee') +select doc11.int from t1 where doc11.string = 'eee'; +`doc11`.`int` 5 -explain extended select doc1.int from t1 use document keys where doc1.string = 'eee'; +explain extended select doc11.int from t1 use document keys where doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_string doc1_string 101 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_string doc11_string 6 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` = 'eee') -select doc1.int from t1 use document keys where doc1.string = 'eee'; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` = 'eee') +select doc11.int from t1 use document keys where doc11.string = 'eee'; +`doc11`.`int` 5 -explain extended select sum(doc1.int) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +explain extended select sum(doc11.int) from t1 use document keys group by doc11.string having doc11.string = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc1`.`int`) AS `sum(doc1.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`string` having (`test`.`t1`.`doc1`.`string` = 'eee') -select sum(doc1.int) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -sum(doc1.int) +Note 1003 /* select#1 */ select sum(`test`.`t1`.`doc11`.`int`) AS `sum(doc11.int)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`string` having (`test`.`t1`.`doc11`.`string` = 'eee') +select sum(doc11.int) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +sum(doc11.int) 5 -explain extended select a from t1 where doc1.string like 'e%'; +explain extended select a1 from t1 where doc11.string like 'e%'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc1`.`string` like 'e%') -select a from t1 where doc1.string like 'e%'; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`string` like 'e%') +select a1 from t1 where doc11.string like 'e%'; +a1 5 -explain extended select a from t1 use document keys where doc1.string like 'e%'; +explain extended select a1 from t1 use document keys where doc11.string like 'e%'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_string NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` like 'e%') -select a from t1 use document keys where doc1.string like 'e%'; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` like 'e%') +select a1 from t1 use document keys where doc11.string like 'e%'; +a1 5 -explain extended select doc1.string from t1 where doc1.string like 'e%'; +explain extended select doc11.string from t1 where doc11.string like 'e%'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`string` AS "`doc1`.`string`" from `test`.`t1` where (`test`.`t1`.`doc1`.`string` like 'e%') -select doc1.string from t1 where doc1.string like 'e%'; -`doc1`.`string` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` where (`test`.`t1`.`doc11`.`string` like 'e%') +select doc11.string from t1 where doc11.string like 'e%'; +`doc11`.`string` eee -explain extended select doc1.string from t1 use document keys where doc1.string like 'e%'; +explain extended select doc11.string from t1 use document keys where doc11.string like 'e%'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_string NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`string` AS "`doc1`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` like 'e%') -select doc1.string from t1 use document keys where doc1.string like 'e%'; -`doc1`.`string` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` like 'e%') +select doc11.string from t1 use document keys where doc11.string like 'e%'; +`doc11`.`string` eee -explain extended select * from t1 where doc1.string like 'e%'; +explain extended select * from t1 where doc11.string like 'e%'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` where (`test`.`t1`.`doc11`.`string` like 'e%') +select * from t1 where doc11.string like 'e%'; +a1 b1 c1 d1 doc11 doc12 +5 5 5.5 eee {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} +explain extended select * from t1 use document keys where doc11.string like 'e%'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` like 'e%') +select * from t1 use document keys where doc11.string like 'e%'; +a1 b1 c1 d1 doc11 doc12 +5 5 5.5 eee {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} +explain extended select doc11 from t1 where doc11.string like 'e%'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc1`.`string` like 'e%') -select * from t1 where doc1.string like 'e%'; -a b c d doc1 doc2 -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -explain extended select * from t1 use document keys where doc1.string like 'e%'; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` where (`test`.`t1`.`doc11`.`string` like 'e%') +select doc11 from t1 where doc11.string like 'e%'; +doc11 +{"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +explain extended select doc11 from t1 use document keys where doc11.string like 'e%'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_string NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` like 'e%') -select * from t1 use document keys where doc1.string like 'e%'; -a b c d doc1 doc2 -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -explain extended select doc1 from t1 where doc1.string like 'e%'; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` like 'e%') +select doc11 from t1 use document keys where doc11.string like 'e%'; +doc11 +{"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +explain extended select doc11.int from t1 where doc11.string like 'e%'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` where (`test`.`t1`.`doc1`.`string` like 'e%') -select doc1 from t1 where doc1.string like 'e%'; -doc1 -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select doc1 from t1 use document keys where doc1.string like 'e%'; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`doc11`.`string` like 'e%') +select doc11.int from t1 where doc11.string like 'e%'; +`doc11`.`int` +5 +explain extended select doc11.int from t1 use document keys where doc11.string like 'e%'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_string NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` like 'e%') -select doc1 from t1 use document keys where doc1.string like 'e%'; -doc1 -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select doc1.int from t1 where doc1.string like 'e%'; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` like 'e%') +select doc11.int from t1 use document keys where doc11.string like 'e%'; +`doc11`.`int` +5 +explain extended select a1 from t1 where doc11.string > 'ee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where (`test`.`t1`.`doc1`.`string` like 'e%') -select doc1.int from t1 where doc1.string like 'e%'; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`string` > 'ee') +select a1 from t1 where doc11.string > 'ee'; +a1 +3 +4 +5 +8 +11 +explain extended select a1 from t1 use document keys where doc11.string > 'eee'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` > 'eee') +select a1 from t1 use document keys where doc11.string > 'eee'; +a1 +8 +11 +explain extended select doc11.string from t1 use document keys where doc11.string >= 'kkk'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` >= 'kkk') +select doc11.string from t1 use document keys where doc11.string >= 'kkk'; +`doc11`.`string` +explain extended select a1 from t1 use document keys where doc11.string > 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` > 'zzz') +select a1 from t1 use document keys where doc11.string > 'zzz'; +a1 +explain extended select a1, doc11.string from t1 use document keys where doc11.string < 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 41.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` < 'iii') +select a1, doc11.string from t1 use document keys where doc11.string < 'iii'; +a1 `doc11`.`string` +1 aaaaaaa +2 2.2 +4 false +5 eee +8 hhh +10 +12 12 +explain extended select doc11.string, a1 from t1 use document keys where doc11.string <= 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` <= 'iii') +select doc11.string, a1 from t1 use document keys where doc11.string <= 'iii'; +`doc11`.`string` a1 +aaaaaaa 1 +2.2 2 +false 4 +eee 5 +hhh 8 + 10 +12 12 +explain extended select doc11.string from t1 use document keys where doc11.string < 'aaa'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` < 'aaa') +select doc11.double from t1 use document keys where doc11.string < 'aaa'; +`doc11`.`double` +10.1 +false +2.2 +explain extended select a1, doc11.string from t1 use document keys where doc11.string > 'eee' and doc11.string < 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` > 'eee') and (`test`.`t1`.`doc11`.`string` < 'iii')) +select a1, doc11.string from t1 use document keys where doc11.string > 'eee' and doc11.string < 'iii'; +a1 `doc11`.`string` +8 hhh +explain extended select a1 from t1 use document keys where doc11.string >= 'eee' and doc11.string <= 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` >= 'eee') and (`test`.`t1`.`doc11`.`string` <= 'iii')) +select a1 from t1 use document keys where doc11.string >= 'eee' and doc11.string <= 'iii'; +a1 5 -explain extended select doc1.int from t1 use document keys where doc1.string like 'e%'; +8 +explain extended select a1 from t1 use document keys where doc11.string > '' and doc11.string < 'zzz'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_string NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 41.67 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`string` like 'e%') -select doc1.int from t1 use document keys where doc1.string like 'e%'; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` > '') and (`test`.`t1`.`doc11`.`string` < 'zzz')) +select a1 from t1 use document keys where doc11.string > '' and doc11.string < 'zzz'; +a1 +1 +2 +3 +4 5 -explain extended select doc1.int from t1 where b = 5; +8 +11 +12 +explain extended select a1, doc11.string from t1 use document keys where doc11.string between 'eee' and 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` between 'eee' and 'iii') +select a1, doc11.string from t1 use document keys where doc11.string between 'eee' and 'iii'; +a1 `doc11`.`string` +5 eee +8 hhh +explain extended select doc11.string from t1 use document keys where doc11.string between 'eee' and 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` between 'eee' and 'zzz') +select doc11.string from t1 use document keys where doc11.string between 'eee' and 'zzz'; +`doc11`.`string` +eee +hhh +k +explain extended select a1, doc11.string from t1 use document keys where doc11.string not between 'eee' and 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` not between 'eee' and 'iii') +select a1, doc11.string from t1 use document keys where doc11.string not between 'eee' and 'iii'; +a1 `doc11`.`string` +1 aaaaaaa +2 2.2 +3 true +10 +11 k +12 12 +explain extended select a1, doc11.string from t1 use document keys where doc11.string not between 'eee' and 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` not between 'eee' and 'zzz') +select a1, doc11.string from t1 use document keys where doc11.string not between 'eee' and 'zzz'; +a1 `doc11`.`string` +1 aaaaaaa +2 2.2 +10 +12 12 +explain extended select a1, doc11.string from t1 use document keys where doc11.string in ('eee', 'ggg', 'iii', 'lll'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` in ('eee','ggg','iii','lll')) +select a1, doc11.string from t1 use document keys where doc11.string in ('eee', 'ggg', 'iii', 'lll'); +a1 `doc11`.`string` +5 eee +explain extended select a1, doc11.string from t1 use document keys where doc11.string in ('eee', 'zzz', ''); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 25.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` in ('eee','zzz','')) +select a1, doc11.string from t1 use document keys where doc11.string in ('eee', 'zzz', ''); +a1 `doc11`.`string` +5 eee +10 +explain extended select a1, doc11.string from t1 use document keys where doc11.string not in ('eee', 'ggg', 'iii', 'lll'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 58.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` not in ('eee','ggg','iii','lll')) +select a1, doc11.string from t1 use document keys where doc11.string not in ('eee', 'ggg', 'iii', 'lll'); +a1 `doc11`.`string` +1 aaaaaaa +2 2.2 +3 true +4 false +8 hhh +10 +11 k +12 12 +explain extended select a1, doc11.string from t1 use document keys where doc11.string not in ('', 'zzz', 'eee', 'fff', 'ggg', 'lll', 'iii', 'hhh'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 83.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` not in ('','zzz','eee','fff','ggg','lll','iii','hhh')) +select a1, doc11.string from t1 use document keys where doc11.string not in ('', 'zzz', 'eee', 'fff', 'ggg', 'lll', 'iii', 'hhh'); +a1 `doc11`.`string` +1 aaaaaaa +2 2.2 +3 true +4 false +11 k +12 12 +explain extended select doc11.string from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'fff' or doc11.string > 'ggg' and doc11.string < 'hhh' or +doc11.string > 'iii' and doc11.string < 'kkk' or doc11.string >= 'lll' and doc11.string <= 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`string` > 'ccc') and (`test`.`t1`.`doc11`.`string` < 'fff')) or ((`test`.`t1`.`doc11`.`string` > 'ggg') and (`test`.`t1`.`doc11`.`string` < 'hhh')) or ((`test`.`t1`.`doc11`.`string` > 'iii') and (`test`.`t1`.`doc11`.`string` < 'kkk')) or ((`test`.`t1`.`doc11`.`string` >= 'lll') and (`test`.`t1`.`doc11`.`string` <= 'zzz'))) +select doc11.string from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'fff' or doc11.string > 'ggg' and doc11.string < 'hhh' or +doc11.string > 'iii' and doc11.string < 'kkk' or doc11.string >= 'lll' and doc11.string <= 'zzz'; +`doc11`.`string` +true +false +eee +k +explain extended select doc11.string from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'hhh' or doc11.string > 'fff' and doc11.string < 'iii' or +doc11.string > 'ggg' and doc11.string <= 'zzz' or doc11.string >= 'lll' and doc11.string < 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`string` > 'ccc') and (`test`.`t1`.`doc11`.`string` < 'hhh')) or ((`test`.`t1`.`doc11`.`string` > 'fff') and (`test`.`t1`.`doc11`.`string` < 'iii')) or ((`test`.`t1`.`doc11`.`string` > 'ggg') and (`test`.`t1`.`doc11`.`string` <= 'zzz')) or ((`test`.`t1`.`doc11`.`string` >= 'lll') and (`test`.`t1`.`doc11`.`string` < 'zzz'))) +select doc11.string from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'hhh' or doc11.string > 'fff' and doc11.string < 'iii' or +doc11.string > 'ggg' and doc11.string <= 'zzz' or doc11.string >= 'lll' and doc11.string < 'zzz'; +`doc11`.`string` +eee +hhh +k +explain extended select doc11.string from t1 use document keys +where ((doc11.string > 'ccc' and doc11.string < 'hhh') and (doc11.string not between 'ggg' and 'iii')) or +((doc11.string between 'kkk' and 'zzz') and (doc11.string not in ('ddd', 'eee'))); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`string` > 'ccc') and (`test`.`t1`.`doc11`.`string` < 'hhh') and (`test`.`t1`.`doc11`.`string` not between 'ggg' and 'iii')) or ((`test`.`t1`.`doc11`.`string` between 'kkk' and 'zzz') and (`test`.`t1`.`doc11`.`string` not in ('ddd','eee')))) +select doc11.string from t1 use document keys +where ((doc11.string > 'ccc' and doc11.string < 'hhh') and (doc11.string not between 'ggg' and 'iii')) or +((doc11.string between 'kkk' and 'zzz') and (doc11.string not in ('ddd', 'eee'))); +`doc11`.`string` +eee +explain extended select a1, doc11.int from t1 where doc11.string > 'eee'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`doc11`.`string` > 'eee') +select a1, doc11.int from t1 where doc11.string > 'eee'; +a1 `doc11`.`int` +3 3 +4 44444 +8 8 +11 11.111 +explain extended select a1, doc11.int from t1 use document keys where doc11.string > 'eee'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` > 'eee') +select a1, doc11.int from t1 use document keys where doc11.string > 'eee'; +a1 `doc11`.`int` +8 8 +11 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.string >= 'kkk'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` >= 'kkk') +select doc11.string, doc11.int from t1 use document keys where doc11.string >= 'kkk'; +`doc11`.`string` `doc11`.`int` +explain extended select a1, doc11.int from t1 use document keys where doc11.string > 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` > 'zzz') +select a1, doc11.int from t1 use document keys where doc11.string > 'zzz'; +a1 `doc11`.`int` +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string < 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 41.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` < 'iii') +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string < 'iii'; +a1 `doc11`.`string` `doc11`.`int` +1 aaaaaaa NULL +2 2.2 true +4 false 44444 +5 eee 5 +8 hhh 8 +10 10 +12 12 false +explain extended select doc11.string, a1, doc11.int from t1 use document keys where doc11.string <= 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 50.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` <= 'iii') +select doc11.string, a1, doc11.int from t1 use document keys where doc11.string <= 'iii'; +`doc11`.`string` a1 `doc11`.`int` +aaaaaaa 1 NULL +2.2 2 true +false 4 44444 +eee 5 5 +hhh 8 8 + 10 10 +12 12 false +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.string < 'aaa'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` < 'aaa') +select doc11.string, doc11.int from t1 use document keys where doc11.string < 'aaa'; +`doc11`.`string` `doc11`.`int` + 10 +12 false +2.2 true +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string > 'eee' and doc11.string < 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` > 'eee') and (`test`.`t1`.`doc11`.`string` < 'iii')) +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string > 'eee' and doc11.string < 'iii'; +a1 `doc11`.`string` `doc11`.`int` +8 hhh 8 +explain extended select a1, doc11.int from t1 use document keys where doc11.string >= 'eee' and doc11.string <= 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` >= 'eee') and (`test`.`t1`.`doc11`.`string` <= 'iii')) +select a1, doc11.int from t1 use document keys where doc11.string >= 'eee' and doc11.string <= 'iii'; +a1 `doc11`.`int` +5 5 +8 8 +explain extended select a1, doc11.int from t1 use document keys where doc11.string > '' and doc11.string < 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 41.67 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` > '') and (`test`.`t1`.`doc11`.`string` < 'zzz')) +select a1, doc11.int from t1 use document keys where doc11.string > '' and doc11.string < 'zzz'; +a1 `doc11`.`int` +1 NULL +2 true +3 3 +4 44444 +5 5 +8 8 +11 11.111 +12 false +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string between 'eee' and 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` between 'eee' and 'iii') +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string between 'eee' and 'iii'; +a1 `doc11`.`string` `doc11`.`int` +5 eee 5 +8 hhh 8 +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.string between 'eee' and 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` between 'eee' and 'zzz') +select doc11.string, doc11.int from t1 use document keys where doc11.string between 'eee' and 'zzz'; +`doc11`.`string` `doc11`.`int` +eee 5 +hhh 8 +k 11.111 +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not between 'eee' and 'iii'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` not between 'eee' and 'iii') +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not between 'eee' and 'iii'; +a1 `doc11`.`string` `doc11`.`int` +1 aaaaaaa NULL +2 2.2 true +3 true 3 +10 10 +11 k 11.111 +12 12 false +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not between 'eee' and 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` not between 'eee' and 'zzz') +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not between 'eee' and 'zzz'; +a1 `doc11`.`string` `doc11`.`int` +1 aaaaaaa NULL +2 2.2 true +10 10 +12 12 false +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string in ('eee', 'ggg', 'iii', 'lll'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` in ('eee','ggg','iii','lll')) +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string in ('eee', 'ggg', 'iii', 'lll'); +a1 `doc11`.`string` `doc11`.`int` +5 eee 5 +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string in ('eee', 'zzz', ''); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref b_a b_a 5 const 1 100.00 NULL +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 25.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where (`test`.`t1`.`b` = 5) -select doc1.int from t1 where b = 5; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` in ('eee','zzz','')) +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string in ('eee', 'zzz', ''); +a1 `doc11`.`string` `doc11`.`int` +5 eee 5 +10 10 +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not in ('eee', 'ggg', 'iii', 'lll'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 58.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` not in ('eee','ggg','iii','lll')) +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not in ('eee', 'ggg', 'iii', 'lll'); +a1 `doc11`.`string` `doc11`.`int` +1 aaaaaaa NULL +2 2.2 true +3 true 3 +4 false 44444 +8 hhh 8 +10 10 +11 k 11.111 +12 12 false +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not in ('', 'zzz', 'eee', 'fff', 'ggg', 'lll', 'iii', 'hhh'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 83.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`string` not in ('','zzz','eee','fff','ggg','lll','iii','hhh')) +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not in ('', 'zzz', 'eee', 'fff', 'ggg', 'lll', 'iii', 'hhh'); +a1 `doc11`.`string` `doc11`.`int` +1 aaaaaaa NULL +2 2.2 true +3 true 3 +4 false 44444 +11 k 11.111 +12 12 false +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'fff' or doc11.string > 'ggg' and doc11.string < 'hhh' or +doc11.string > 'iii' and doc11.string < 'kkk' or doc11.string >= 'lll' and doc11.string <= 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`string` > 'ccc') and (`test`.`t1`.`doc11`.`string` < 'fff')) or ((`test`.`t1`.`doc11`.`string` > 'ggg') and (`test`.`t1`.`doc11`.`string` < 'hhh')) or ((`test`.`t1`.`doc11`.`string` > 'iii') and (`test`.`t1`.`doc11`.`string` < 'kkk')) or ((`test`.`t1`.`doc11`.`string` >= 'lll') and (`test`.`t1`.`doc11`.`string` <= 'zzz'))) +select doc11.string, doc11.int from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'fff' or doc11.string > 'ggg' and doc11.string < 'hhh' or +doc11.string > 'iii' and doc11.string < 'kkk' or doc11.string >= 'lll' and doc11.string <= 'zzz'; +`doc11`.`string` `doc11`.`int` +true 3 +false 44444 +eee 5 +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'hhh' or doc11.string > 'fff' and doc11.string < 'iii' or +doc11.string > 'ggg' and doc11.string <= 'zzz' or doc11.string >= 'lll' and doc11.string < 'zzz'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 3 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`string` > 'ccc') and (`test`.`t1`.`doc11`.`string` < 'hhh')) or ((`test`.`t1`.`doc11`.`string` > 'fff') and (`test`.`t1`.`doc11`.`string` < 'iii')) or ((`test`.`t1`.`doc11`.`string` > 'ggg') and (`test`.`t1`.`doc11`.`string` <= 'zzz')) or ((`test`.`t1`.`doc11`.`string` >= 'lll') and (`test`.`t1`.`doc11`.`string` < 'zzz'))) +select doc11.string, doc11.int from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'hhh' or doc11.string > 'fff' and doc11.string < 'iii' or +doc11.string > 'ggg' and doc11.string <= 'zzz' or doc11.string >= 'lll' and doc11.string < 'zzz'; +`doc11`.`string` `doc11`.`int` +eee 5 +hhh 8 +k 11.111 +explain extended select doc11.string, doc11.int from t1 use document keys +where ((doc11.string > 'ccc' and doc11.string < 'hhh') and (doc11.string not between 'ggg' and 'iii')) or +((doc11.string between 'kkk' and 'zzz') and (doc11.string not in ('ddd', 'eee'))); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (((`test`.`t1`.`doc11`.`string` > 'ccc') and (`test`.`t1`.`doc11`.`string` < 'hhh') and (`test`.`t1`.`doc11`.`string` not between 'ggg' and 'iii')) or ((`test`.`t1`.`doc11`.`string` between 'kkk' and 'zzz') and (`test`.`t1`.`doc11`.`string` not in ('ddd','eee')))) +select doc11.string, doc11.int from t1 use document keys +where ((doc11.string > 'ccc' and doc11.string < 'hhh') and (doc11.string not between 'ggg' and 'iii')) or +((doc11.string between 'kkk' and 'zzz') and (doc11.string not in ('ddd', 'eee'))); +`doc11`.`string` `doc11`.`int` +eee 5 +explain extended select doc11.int from t1 where b1 = 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref b1_a1 b1_a1 5 const 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`b1` = 5) +select doc11.int from t1 where b1 = 5; +`doc11`.`int` 5 -explain extended select doc1.int from t1 use document keys where b = 5; +explain extended select doc11.int from t1 use document keys where b1 = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref b_a,b_doc1 b_a 5 const 1 100.00 NULL +1 SIMPLE t1 ref b1_a1,b1_doc11 b1_a1 5 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`b` = 5) -select doc1.int from t1 use document keys where b = 5; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`b1` = 5) +select doc11.int from t1 use document keys where b1 = 5; +`doc11`.`int` 5 -explain extended select b from t1 where doc1.int = 5; +explain extended select b1 from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select b from t1 where doc1.int = 5; -b +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select b1 from t1 where doc11.int = 5; +b1 5 -explain extended select b from t1 use document keys where doc1.int = 5; +explain extended select b1 from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select b from t1 use document keys where doc1.int = 5; -b +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select b1 from t1 use document keys where doc11.int = 5; +b1 5 -explain extended select count(b) from t1 use document keys group by doc1.int having doc1.int = 5; +explain extended select count(b1) from t1 use document keys group by doc11.int having doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_b 14 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_b1 14 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select count(`test`.`t1`.`b`) AS `count(b)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`int` having (`test`.`t1`.`doc1`.`int` = 5) -select count(b) from t1 use document keys group by doc1.int having doc1.int = 5; -count(b) +Note 1003 /* select#1 */ select count(`test`.`t1`.`b1`) AS `count(b1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`int` having (`test`.`t1`.`doc11`.`int` = 5) +select count(b1) from t1 use document keys group by doc11.int having doc11.int = 5; +count(b1) 1 -explain extended select b from t1 where doc1.int > 5; +explain extended select b1 from t1 where doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` > 5) -select b from t1 where doc1.int > 5; -b -6 +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` > 5) +select b1 from t1 where doc11.int > 5; +b1 +4 7 8 -9 10 11 -12 -explain extended select d from t1 use document keys where doc1.int > 5; +explain extended select d1 from t1 use document keys where doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_d 110 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 index doc11_int doc11_d1 20 NULL 12 41.67 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) -select b from t1 use document keys where doc1.int > 5; -b -6 +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` > 5) +select b1 from t1 use document keys where doc11.int > 5; +b1 7 8 -9 10 11 -12 -explain extended select sum(b) from t1 use document keys group by doc1.int having doc1.int > 5; +4 +explain extended select sum(b1) from t1 use document keys group by doc11.int having doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_b 14 NULL 12 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1 index NULL doc11_b1 14 NULL 12 100.00 Using index; Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select sum(`test`.`t1`.`b`) AS `sum(b)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc1`.`int` having (`test`.`t1`.`doc1`.`int` > 5) -select sum(b) from t1 use document keys group by doc1.int having doc1.int > 5; -sum(b) -6 +Note 1003 /* select#1 */ select sum(`test`.`t1`.`b1`) AS `sum(b1)` from `test`.`t1` USE DOCUMENT INDEXES group by `test`.`t1`.`doc11`.`int` having (`test`.`t1`.`doc11`.`int` > 5) +select sum(b1) from t1 use document keys group by doc11.int having doc11.int > 5; +sum(b1) 7 8 -9 10 11 -12 -explain extended select doc1.double from t1 where c = 5.5; +4 +explain extended select doc11.double from t1 where c1 = 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` where (`test`.`t1`.`c` = 5.5) -select doc1.double from t1 where c = 5.5; -`doc1`.`double` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` where (`test`.`t1`.`c1` = 5.5) +select doc11.double from t1 where c1 = 5.5; +`doc11`.`double` 5.5 -explain extended select doc1.double from t1 use document keys where c = 5.5; +explain extended select doc11.double from t1 use document keys where c1 = 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_c 18 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 index NULL doc11_c1 18 NULL 12 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`c` = 5.5) -select doc1.double from t1 use document keys where c = 5.5; -`doc1`.`double` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`c1` = 5.5) +select doc11.double from t1 use document keys where c1 = 5.5; +`doc11`.`double` 5.5 -explain extended select c from t1 where doc1.double = 5.5; +explain extended select c1 from t1 where doc11.double = 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`doc1`.`double` = 5.5) -select c from t1 where doc1.double = 5.5; -c +Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (`test`.`t1`.`doc11`.`double` = 5.5) +select c1 from t1 where doc11.double = 5.5; +c1 5.5 -explain extended select c from t1 use document keys where doc1.double = 5.5; +explain extended select c1 from t1 use document keys where doc11.double = 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_double doc1_double 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_double doc11_double 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`c` AS `c` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`double` = 5.5) -select c from t1 use document keys where doc1.double = 5.5; -c +Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` = 5.5) +select c1 from t1 use document keys where doc11.double = 5.5; +c1 5.5 -explain extended select c from t1 use document keys where doc1.double = '5.5'; +explain extended select c1 from t1 use document keys where doc11.double = '5.5'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_double doc1_double 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_double doc11_double 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`c` AS `c` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`double` = '5.5') -select c from t1 use document keys where doc1.double = '5.5'; -c +Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` = '5.5') +select c1 from t1 use document keys where doc11.double = '5.5'; +c1 5.5 -explain extended select c from t1 where doc1.double > 5.5; +explain extended select c1 from t1 where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`doc1`.`double` > 5.5) -select c from t1 where doc1.double > 5.5; -c -6.6 -7.7 +Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (`test`.`t1`.`doc11`.`double` > 5.5) +select c1 from t1 where doc11.double > 5.5; +c1 8.8 -9.9 10.1 -11.11 -12.12 -explain extended select c from t1 use document keys where doc1.double > 5.5; +explain extended select c1 from t1 use document keys where doc11.double > 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_double doc1_c 18 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`c` AS `c` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`double` > 5.5) -select c from t1 use document keys where doc1.double > 5.5; -c -6.6 -7.7 +Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > 5.5) +select c1 from t1 use document keys where doc11.double > 5.5; +c1 8.8 -9.9 10.1 -11.11 -12.12 -explain extended select doc1.int from t1 where d = 'eee'; +explain extended select doc11.int from t1 where d1 = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where (`test`.`t1`.`d` = 'eee') -select doc1.int from t1 where d = 'eee'; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`d1` = 'eee') +select doc11.int from t1 where d1 = 'eee'; +`doc11`.`int` 5 -explain extended select doc1.int from t1 use document keys where d = 'eee'; +explain extended select doc11.int from t1 use document keys where d1 = 'eee'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL doc1_d 110 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 index NULL doc11_d1 20 NULL 12 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`d` = 'eee') -select doc1.int from t1 use document keys where d = 'eee'; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`d1` = 'eee') +select doc11.int from t1 use document keys where d1 = 'eee'; +`doc11`.`int` 5 -explain extended select d from t1 where doc1.int = 5; +explain extended select d1 from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select d from t1 where doc1.int = 5; -d +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select d1 from t1 where doc11.int = 5; +d1 eee -explain extended select d from t1 use document keys where doc1.int = 5; +explain extended select d1 from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select d from t1 use document keys where doc1.int = 5; -d +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select d1 from t1 use document keys where doc11.int = 5; +d1 eee -explain extended select d from t1 where doc1.int > 5; +explain extended select d1 from t1 where doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` > 5) -select d from t1 where doc1.int > 5; -d -fff +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` > 5) +select d1 from t1 where doc11.int > 5; +d1 +ddd ggg hhh -iii jjj kkk -lll -explain extended select d from t1 use document keys where doc1.int > 5; +explain extended select d1 from t1 use document keys where doc11.int > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_d 110 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 index doc11_int doc11_d1 20 NULL 12 41.67 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) -select d from t1 use document keys where doc1.int > 5; -d -fff +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` > 5) +select d1 from t1 use document keys where doc11.int > 5; +d1 ggg hhh -iii jjj kkk -lll -explain extended select d from t1 where doc1.int = '5'; +ddd +explain extended select d1 from t1 where doc11.int = '5'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = '5') -select d from t1 where doc1.int = '5'; -d +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = '5') +select d1 from t1 where doc11.int = '5'; +d1 eee -explain extended select d from t1 use document keys where doc1.int = '5'; +explain extended select d1 from t1 use document keys where doc11.int = '5'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = '5') -select d from t1 use document keys where doc1.int = '5'; -d +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = '5') +select d1 from t1 use document keys where doc11.int = '5'; +d1 eee -explain extended select d from t1 where doc1.int < '5'; +explain extended select d1 from t1 where doc11.int < '5'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` < '5') -select d from t1 where doc1.int < '5'; -d -aaa +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` < '5') +select d1 from t1 where doc11.int < '5'; +d1 bbb ccc -ddd -jjj -kkk lll -explain extended select d from t1 use document keys where doc1.int < '5'; +explain extended select d1 from t1 use document keys where doc11.int < '5'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_d 110 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` < '5') -select d from t1 use document keys where doc1.int < '5'; -d -aaa +Note 1003 /* select#1 */ select `test`.`t1`.`d1` AS `d1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` < '5') +select d1 from t1 use document keys where doc11.int < '5'; +d1 +lll bbb ccc -ddd -jjj -kkk -lll -explain extended select a from t1 where doc1.int = 5; +explain extended select a1 from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select a from t1 where doc1.int = 5; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select a1 from t1 where doc11.int = 5; +a1 5 -explain extended select a from t1 use document keys where doc1.int = 5; +explain extended select a1 from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where; Using index +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select a from t1 use document keys where doc1.int = 5; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select a1 from t1 use document keys where doc11.int = 5; +a1 5 -explain extended select a from t1 where doc1.int >= 5; +explain extended select a1 from t1 where doc11.int >= 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` >= 5) -select a from t1 where doc1.int >= 5; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` >= 5) +select a1 from t1 where doc11.int >= 5; +a1 +4 5 -6 7 8 -9 10 11 -12 -explain extended select a from t1 use document keys where doc1.int >= 5; +explain extended select a1 from t1 use document keys where doc11.int >= 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_int 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 6 100.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` >= 5) -select a from t1 use document keys where doc1.int >= 5; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` >= 5) +select a1 from t1 use document keys where doc11.int >= 5; +a1 5 -6 7 8 -9 10 11 -12 -explain extended select a from t1 where d like 'eee' and doc1.int = 5; +4 +explain extended select a1 from t1 where d1 like 'eee' and doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`d` like 'eee') and (`test`.`t1`.`doc1`.`int` = 5)) -select a from t1 where d like 'eee' and doc1.int = 5; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where ((`test`.`t1`.`doc11`.`int` = 5) and (`test`.`t1`.`d1` like 'eee')) +select a1 from t1 where d1 like 'eee' and doc11.int = 5; +a1 5 -explain extended select a from t1 use document keys where d like 'eee' and doc1.int = 5; +explain extended select a1 from t1 use document keys where d1 like 'eee' and doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`d` like 'eee') and (`test`.`t1`.`doc1`.`int` = 5)) -select a from t1 use document keys where d like 'eee' and doc1.int = 5; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` = 5) and (`test`.`t1`.`d1` like 'eee')) +select a1 from t1 use document keys where d1 like 'eee' and doc11.int = 5; +a1 5 -explain extended select a from t1 where d like 'e%' and doc1.int > 4; +explain extended select a1 from t1 where d1 like 'e%' and doc11.int > 4; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`d` like 'e%') and (`test`.`t1`.`doc1`.`int` > 4)) -select a from t1 where d like 'e%' and doc1.int > 4; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where ((`test`.`t1`.`d1` like 'e%') and (`test`.`t1`.`doc11`.`int` > 4)) +select a1 from t1 where d1 like 'e%' and doc11.int > 4; +a1 5 -explain extended select a from t1 use document keys where d like 'e%' and doc1.int > 4; +explain extended select a1 from t1 use document keys where d1 like 'e%' and doc11.int > 4; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_d 110 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 index doc11_int doc11_d1 20 NULL 12 50.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`d` like 'e%') and (`test`.`t1`.`doc1`.`int` > 4)) -select a from t1 use document keys where d like 'e%' and doc1.int > 4; -a +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`d1` like 'e%') and (`test`.`t1`.`doc11`.`int` > 4)) +select a1 from t1 use document keys where d1 like 'e%' and doc11.int > 4; +a1 5 -explain extended select a, d, doc1.int from t1 where d like 'eee' and doc1.int = 5; +explain extended select a1, d1, doc11.int from t1 where d1 like 'eee' and doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where ((`test`.`t1`.`d` like 'eee') and (`test`.`t1`.`doc1`.`int` = 5)) -select a, d, doc1.int from t1 where d like 'eee' and doc1.int = 5; -a d `doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where ((`test`.`t1`.`doc11`.`int` = 5) and (`test`.`t1`.`d1` like 'eee')) +select a1, d1, doc11.int from t1 where d1 like 'eee' and doc11.int = 5; +a1 d1 `doc11`.`int` 5 eee 5 -explain extended select a, d, doc1.int from t1 use document keys where d like 'eee' and doc1.int = 5; +explain extended select a1, d1, doc11.int from t1 use document keys where d1 like 'eee' and doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`d` like 'eee') and (`test`.`t1`.`doc1`.`int` = 5)) -select a, d, doc1.int from t1 use document keys where d like 'eee' and doc1.int = 5; -a d `doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` = 5) and (`test`.`t1`.`d1` like 'eee')) +select a1, d1, doc11.int from t1 use document keys where d1 like 'eee' and doc11.int = 5; +a1 d1 `doc11`.`int` 5 eee 5 -explain extended select a, d, doc1.int from t1 where d like 'e%' and doc1.int < 6; +explain extended select a1, d1, doc11.int from t1 where d1 like 'e%' and doc11.int < 6; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where ((`test`.`t1`.`d` like 'e%') and (`test`.`t1`.`doc1`.`int` < 6)) -select a, d, doc1.int from t1 where d like 'e%' and doc1.int < 6; -a d `doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where ((`test`.`t1`.`d1` like 'e%') and (`test`.`t1`.`doc11`.`int` < 6)) +select a1, d1, doc11.int from t1 where d1 like 'e%' and doc11.int < 6; +a1 d1 `doc11`.`int` 5 eee 5 -explain extended select a, d, doc1.int from t1 use document keys where d like 'e%' and doc1.int < 6; +explain extended select a1, d1, doc11.int from t1 use document keys where d1 like 'e%' and doc11.int < 6; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index doc1_int doc1_d 110 NULL 12 100.00 Using where; Using index +1 SIMPLE t1 index doc11_int doc11_d1 20 NULL 12 25.00 Using where; Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`d` like 'e%') and (`test`.`t1`.`doc1`.`int` < 6)) -select a, d, doc1.int from t1 use document keys where d like 'e%' and doc1.int < 6; -a d `doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`d1` like 'e%') and (`test`.`t1`.`doc11`.`int` < 6)) +select a1, d1, doc11.int from t1 use document keys where d1 like 'e%' and doc11.int < 6; +a1 d1 `doc11`.`int` 5 eee 5 -explain extended select b from t1 where doc1.int = 5; +explain extended select b1 from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select b from t1 where doc1.int = 5; -b +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select b1 from t1 where doc11.int = 5; +b1 5 -explain extended select b from t1 use document keys where doc1.int = 5; +explain extended select b1 from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select b from t1 use document keys where doc1.int = 5; -b +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select b1 from t1 use document keys where doc11.int = 5; +b1 5 -explain extended select * from t1 where doc1.int = 5; +explain extended select * from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select * from t1 where doc1.int = 5; -a b c d doc1 doc2 -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -explain extended select * from t1 use document keys where doc1.int = 5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select * from t1 where doc11.int = 5; +a1 b1 c1 d1 doc11 doc12 +5 5 5.5 eee {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} +explain extended select * from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t1`.`doc1` AS `doc1`,`test`.`t1`.`doc2` AS `doc2` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select * from t1 use document keys where doc1.int = 5; -a b c d doc1 doc2 -5 5 5.5 eee {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} -explain extended select doc1.double from t1 where doc1.int = 5; +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t1`.`c1` AS `c1`,`test`.`t1`.`d1` AS `d1`,`test`.`t1`.`doc11` AS `doc11`,`test`.`t1`.`doc12` AS `doc12` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select * from t1 use document keys where doc11.int = 5; +a1 b1 c1 d1 doc11 doc12 +5 5 5.5 eee {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} {"int":5,"double":5.5} +explain extended select doc11.double from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select doc1.double from t1 where doc1.int = 5; -`doc1`.`double` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select doc11.double from t1 where doc11.int = 5; +`doc11`.`double` 5.5 -explain extended select doc1.double from t1 use document keys where doc1.int = 5; +explain extended select doc11.double from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select doc1.double from t1 use document keys where doc1.int = 5; -`doc1`.`double` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select doc11.double from t1 use document keys where doc11.int = 5; +`doc11`.`double` 5.5 -explain extended select doc1 from t1 where doc1.int = 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select doc1 from t1 where doc1.int = 5; -doc1 -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select doc1 from t1 use document keys where doc1.int = 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select doc1 from t1 use document keys where doc1.int = 5; -doc1 -{"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select doc1.double from t1 where doc1.int < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` where (`test`.`t1`.`doc1`.`int` < 5) -select doc1.double from t1 where doc1.int < 5; -`doc1`.`double` -1.1 -2.2 -3.3 -4.4 -explain extended select doc1.double from t1 use document keys where doc1.int < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_int NULL NULL NULL 12 100.00 Using where -Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` < 5) -select doc1.double from t1 use document keys where doc1.int < 5; -`doc1`.`double` -1.1 -2.2 -3.3 -4.4 -explain extended select doc1 from t1 where doc1.int > 5; +explain extended select doc11 from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` > 5) -select doc1 from t1 where doc1.int > 5; -doc1 -{"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} -{"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} -{"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} -{"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} -{"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} -{"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} -{"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} -explain extended select doc1 from t1 use document keys where doc1.int > 5; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select doc11 from t1 where doc11.int = 5; +doc11 +{"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +explain extended select doc11 from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL doc1_int NULL NULL NULL 12 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` > 5) -select doc1 from t1 use document keys where doc1.int > 5; -doc1 -{"bool":false,"int":6,"double":6.6,"string":"fff","k1":{"k2":{"k3":{"int":6}}},"id":6} -{"bool":false,"int":7,"double":7.7,"string":"ggg","k1":{"k2":{"k3":{"int":7}}},"id":7} -{"bool":false,"int":8,"double":8.8,"string":"hhh","k1":{"k2":{"k3":{"int":8}}},"id":8} -{"bool":false,"int":9,"double":9.9,"string":"iii","k1":{"k2":{"k3":{"int":9}}},"id":9} -{"bool":false,"int":10,"double":10.1,"string":"jjj","k1":{"k2":{"k3":{"int":10}}},"id":10} -{"bool":false,"int":11,"double":11.11,"string":"kkk","k1":{"k2":{"k3":{"int":11}}},"id":11} -{"bool":false,"int":12,"double":12.12,"string":"lll","k1":{"k2":{"k3":{"int":12}}},"id":12} -explain extended select b, doc1.double from t1 where doc1.int = 5; +Note 1003 /* select#1 */ select `test`.`t1`.`doc11` AS `doc11` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select doc11 from t1 use document keys where doc11.int = 5; +doc11 +{"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +explain extended select b1, doc11.double from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b`,`test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select b, doc1.double from t1 where doc1.int = 5; -b `doc1`.`double` +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select b1, doc11.double from t1 where doc11.int = 5; +b1 `doc11`.`double` 5 5.5 -explain extended select b, doc1.double from t1 use document keys where doc1.int = 5; +explain extended select b1, doc11.double from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b`,`test`.`t1`.`doc1`.`double` AS "`doc1`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select b, doc1.double from t1 use document keys where doc1.int = 5; -b `doc1`.`double` +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1`,`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select b1, doc11.double from t1 use document keys where doc11.int = 5; +b1 `doc11`.`double` 5 5.5 -explain extended select b, doc1 from t1 where doc1.int = 5; +explain extended select b1, doc11 from t1 where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b`,`test`.`t1`.`doc1` AS `doc1` from `test`.`t1` where (`test`.`t1`.`doc1`.`int` = 5) -select b, doc1 from t1 where doc1.int = 5; -b doc1 -5 {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select b, doc1 from t1 use document keys where doc1.int = 5; +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1`,`test`.`t1`.`doc11` AS `doc11` from `test`.`t1` where (`test`.`t1`.`doc11`.`int` = 5) +select b1, doc11 from t1 where doc11.int = 5; +b1 doc11 +5 {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +explain extended select b1, doc11 from t1 use document keys where doc11.int = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b`,`test`.`t1`.`doc1` AS `doc1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`int` = 5) -select b, doc1 from t1 use document keys where doc1.int = 5; -b doc1 -5 {"bool":true,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} -explain extended select b from t1 where doc1.int = 5 and d = 5.5; +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1`,`test`.`t1`.`doc11` AS `doc11` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`int` = 5) +select b1, doc11 from t1 use document keys where doc11.int = 5; +b1 doc11 +5 {"bool":false,"int":5,"double":5.5,"string":"eee","k1":{"k2":{"k3":{"int":5}}},"id":5} +explain extended select b1 from t1 where doc11.int = 5 and d1 = 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`doc1`.`int` = 5) and (`test`.`t1`.`d` = 5.5)) -select b from t1 where doc1.int = 5 and d = 5.5; -b +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` where ((`test`.`t1`.`doc11`.`int` = 5) and (`test`.`t1`.`d1` = 5.5)) +select b1 from t1 where doc11.int = 5 and d1 = 5.5; +b1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'eee ' -explain extended select b from t1 use document keys where doc1.int = 5 and d = 5.5; +Warning 1292 Truncated incorrect DOUBLE value: 'eee ' +explain extended select b1 from t1 use document keys where doc11.int = 5 and d1 = 5.5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc1`.`int` = 5) and (`test`.`t1`.`d` = 5.5)) -select b from t1 use document keys where doc1.int = 5 and d = 5.5; -b +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` = 5) and (`test`.`t1`.`d1` = 5.5)) +select b1 from t1 use document keys where doc11.int = 5 and d1 = 5.5; +b1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'eee ' -explain extended select b from t1 where doc1.int = 5 and d > 5; +Warning 1292 Truncated incorrect DOUBLE value: 'eee ' +explain extended select b1 from t1 where doc11.int = 5 and d1 > 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`doc1`.`int` = 5) and (`test`.`t1`.`d` > 5)) -select b from t1 where doc1.int = 5 and d > 5; -b +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` where ((`test`.`t1`.`doc11`.`int` = 5) and (`test`.`t1`.`d1` > 5)) +select b1 from t1 where doc11.int = 5 and d1 > 5; +b1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'eee ' -explain extended select b from t1 use document keys where doc1.int = 5 and d > 5; +Warning 1292 Truncated incorrect DOUBLE value: 'eee ' +explain extended select b1 from t1 use document keys where doc11.int = 5 and d1 > 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref doc1_int doc1_int 9 const 1 100.00 Using where +1 SIMPLE t1 ref doc11_int doc11_int 9 const 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`b` AS `b` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc1`.`int` = 5) and (`test`.`t1`.`d` > 5)) -select b from t1 use document keys where doc1.int = 5 and d > 5; -b +Note 1003 /* select#1 */ select `test`.`t1`.`b1` AS `b1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` = 5) and (`test`.`t1`.`d1` > 5)) +select b1 from t1 use document keys where doc11.int = 5 and d1 > 5; +b1 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'eee ' -explain extended select c from t1 where doc1.int = 5 and b = 5; +Warning 1292 Truncated incorrect DOUBLE value: 'eee ' +explain extended select c1 from t1 where doc11.int = 5 and b1 = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref b_a b_a 5 const 1 100.00 Using where +1 SIMPLE t1 ref b1_a1 b1_a1 5 const 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 5) and (`test`.`t1`.`doc1`.`int` = 5)) -select c from t1 where doc1.int = 5 and b = 5; -c +Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`b1` = 5) and (`test`.`t1`.`doc11`.`int` = 5)) +select c1 from t1 where doc11.int = 5 and b1 = 5; +c1 5.5 -explain extended select c from t1 use document keys where doc1.int = 5 and b = 5; +explain extended select c1 from t1 use document keys where doc11.int = 5 and b1 = 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref b_a,doc1_int,b_doc1 b_a 5 const 1 100.00 Using where +1 SIMPLE t1 ref b1_a1,doc11_int,b1_doc11 b1_a1 5 const 1 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`c` AS `c` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`b` = 5) and (`test`.`t1`.`doc1`.`int` = 5)) -select c from t1 use document keys where doc1.int = 5 and b = 5; -c +Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` USE DOCUMENT INDEXES where ((`test`.`t1`.`b1` = 5) and (`test`.`t1`.`doc11`.`int` = 5)) +select c1 from t1 use document keys where doc11.int = 5 and b1 = 5; +c1 5.5 -explain extended select doc1.int from t1 where doc1.id = 5; +explain extended select doc11.int from t1 where doc11.id = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` where (`test`.`t1`.`doc1`.`id` = 5) -select doc1.int from t1 where doc1.id = 5; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` where (`test`.`t1`.`doc11`.`id` = 5) +select doc11.int from t1 where doc11.id = 5; +`doc11`.`int` 5 -explain extended select doc1.int from t1 use document keys where doc1.id = 5; +explain extended select doc11.int from t1 use document keys where doc11.id = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`doc1`.`int` AS "`doc1`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`id` = 5) -select doc1.int from t1 use document keys where doc1.id = 5; -`doc1`.`int` +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`" from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`id` = 5) +select doc11.int from t1 use document keys where doc11.id = 5; +`doc11`.`int` 5 -explain extended select a, b from t1 where doc1.id = 5; +explain extended select a1, b1 from t1 where doc11.id = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`doc1`.`id` = 5) -select a, b from t1 where doc1.id = 5; -a b +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1` from `test`.`t1` where (`test`.`t1`.`doc11`.`id` = 5) +select a1, b1 from t1 where doc11.id = 5; +a1 b1 5 5 -explain extended select a, b from t1 use document keys where doc1.id = 5; +explain extended select a1, b1 from t1 use document keys where doc11.id = 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc1`.`id` = 5) -select a, b from t1 use document keys where doc1.id = 5; -a b +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1` from `test`.`t1` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`id` = 5) +select a1, b1 from t1 use document keys where doc11.id = 5; +a1 b1 5 5 -select a, doc1.int from t1 use document keys order by doc1.int; -a `doc1`.`int` -1 1 -2 2 +select a1, doc11.int from t1 use document keys order by doc11.int; +a1 `doc11`.`int` +1 NULL +6 NULL +9 NULL +12 0 +2 1 3 3 -4 4 5 5 -6 6 7 7 8 8 -9 9 10 10 11 11 -12 12 -drop table t1; +4 44444 +explain extended select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.int = t2.doc21.int; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index doc11_int doc11_int 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t2 ref doc21_int doc21_int 9 test.t1.`doc11`.`int` 1 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where (`test`.`t2`.`doc21`.`int` = `test`.`t1`.`doc11`.`int`) +select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.int = t2.doc21.int; +`doc11`.`int` `doc21`.`int` +1 1 +1 1 +7 7 +10 10 +11 11 +explain extended select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where t1.doc11.bool = t2.doc21.bool and t1.doc11.int < 3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool,doc11_int doc11_int 9 NULL 1 100.00 Using where +1 SIMPLE t2 ref doc21_bool doc21_bool 2 test.t1.`doc11`.`bool` 2 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t2`.`doc21`.`bool` = `test`.`t1`.`doc11`.`bool`) and (`test`.`t1`.`doc11`.`int` < 3)) +explain extended select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double = t2.doc21.double; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index doc11_double doc11_double 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t2 ref doc21_double doc21_double 9 test.t1.`doc11`.`double` 1 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where (`test`.`t2`.`doc21`.`double` = `test`.`t1`.`doc11`.`double`) +NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double = t2.doc21.double; +`doc11`.`double` `doc21`.`double` +0 0 +0 0 +1 1 +1 1 +1 1 +1 1 +2.2 2.2 +8.8 8.8 +10.1 10.1 +explain extended select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.string = t2.doc21.string; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 ref doc21_string doc21_string 5 test.t1.`doc11`.`string` 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where (`test`.`t2`.`doc21`.`string` = `test`.`t1`.`doc11`.`string`) +select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.string = t2.doc21.string; +`doc11`.`string` `doc21`.`string` +aaaaaaa aaaaaaa +2.2 2.2 +hhh hhh + +k k +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.int = t2.doc21.int; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 ref doc21_int doc21_int 9 test.t1.`doc11`.`int` 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where (`test`.`t2`.`doc21`.`int` = `test`.`t1`.`doc11`.`int`) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.int = t2.doc21.int; +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` +true 2.2 1 aaaaaaa +true 2.2 true 2.2 +7.777 NULL 7 NULL +10 10 +11.111 k 11.111 k +explain extended select t1.doc11.bool, t1.doc11.string, t2.doc21.bool, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.bool = t2.doc21.bool and t1.doc11.bool is false; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 ALL doc21_bool NULL NULL NULL 12 75.00 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t2`.`doc21`.`bool` = `test`.`t1`.`doc11`.`bool`) and (`test`.`t1`.`doc11`.`bool` is false)) +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double = t2.doc21.double; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 ref doc21_double doc21_double 9 test.t1.`doc11`.`double` 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where (`test`.`t2`.`doc21`.`double` = `test`.`t1`.`doc11`.`double`) +NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double = t2.doc21.double; +`doc11`.`double` `doc11`.`string` `doc21`.`double` `doc21`.`string` +1 aaaaaaa 1 aaaaaaa +1 aaaaaaa true k +2.2 2.2 2.2 2.2 +false NULL false NULL +8.8 hhh 8.8 hhh +10.1 10.1 +true k 1 aaaaaaa +true k true k +false 12 false NULL +explain extended select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.string = t2.doc21.string; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 ref doc21_string doc21_string 5 test.t1.`doc11`.`string` 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where (`test`.`t2`.`doc21`.`string` = `test`.`t1`.`doc11`.`string`) +select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.string = t2.doc21.string; +`doc11`.`string` `doc11`.`int` `doc21`.`string` `doc21`.`int` +aaaaaaa NULL aaaaaaa 1 +2.2 true 2.2 true +hhh 8 hhh NULL + 10 10 +k 11.111 k 11.111 +explain extended select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > 10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_int doc21_int 9 NULL 2 100.00 Using where; Using index +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x8) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` > `test`.`t2`.`doc21`.`int`) and (`test`.`t2`.`doc21`.`int` > 10)) +select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > 10; +`doc11`.`int` `doc21`.`int` +44444 11 +explain extended select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_int doc21_int 9 NULL 2 100.00 Using where; Using index +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 4 100.00 Using where; Using index; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` between 3 and 8) and (`test`.`t2`.`doc21`.`int` between 7 and 9) and (`test`.`t1`.`doc11`.`int` > `test`.`t2`.`doc21`.`int`)) +select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; +`doc11`.`int` `doc21`.`int` +8 7 +explain extended select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 index doc21_bool doc21_bool 2 NULL 12 16.67 Using where; Using index +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x4) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` > `test`.`t2`.`doc21`.`bool`) and (`test`.`t2`.`doc21`.`bool` > 0)) +select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > 0; +`doc11`.`bool` `doc21`.`bool` +explain extended select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where (t1.doc11.bool between 1 and 2) and (t2.doc21.bool between 7 and 9) and t1.doc11.bool > t2.doc21.bool; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where; Using index +1 SIMPLE t2 index doc21_bool doc21_bool 2 NULL 12 16.67 Using where; Using index; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` between 1 and 2) and (`test`.`t2`.`doc21`.`bool` between 7 and 9) and (`test`.`t1`.`doc11`.`bool` > `test`.`t2`.`doc21`.`bool`)) +select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where (t1.doc11.bool between 1 and 2) and (t2.doc21.bool between 7 and 9) and t1.doc11.bool > t2.doc21.bool; +`doc11`.`bool` `doc21`.`bool` +explain extended select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index doc11_double doc11_double 9 NULL 12 100.00 Using index +1 SIMPLE t2 ALL doc21_double NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x10) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > `test`.`t2`.`doc21`.`double`) +NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double; +`doc11`.`double` `doc21`.`double` +1 0 +1 0 +2.2 0 +2.2 1 +2.2 1 +3.3 0 +3.3 1 +3.3 1 +3.3 2.2 +5.5 0 +5.5 1 +5.5 1 +5.5 2.2 +8.8 0 +8.8 1 +8.8 1 +8.8 2.2 +8.8 6 +10.1 0 +10.1 1 +10.1 1 +10.1 2.2 +10.1 6 +10.1 8.8 +10.1 9.9 +explain extended select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > 1.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_double doc21_double 9 NULL 5 100.00 Using where; Using index +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x10) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` > `test`.`t2`.`doc21`.`double`) and (`test`.`t2`.`doc21`.`double` > 1.1)) +select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > 1.1; +`doc11`.`double` `doc21`.`double` +3.3 2.2 +5.5 2.2 +8.8 2.2 +10.1 2.2 +8.8 6 +10.1 6 +10.1 8.8 +10.1 9.9 +explain extended select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where (t1.doc11.double between 1.1 and 9.9) and (t2.doc21.double between 2.2 and 11.11) and t1.doc11.double >= t2.doc21.double; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 4 100.00 Using where; Using index +1 SIMPLE t2 range doc21_double doc21_double 9 NULL 5 100.00 Using where; Using index; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` between 1.1 and 9.9) and (`test`.`t2`.`doc21`.`double` between 2.2 and 11.11) and (`test`.`t1`.`doc11`.`double` >= `test`.`t2`.`doc21`.`double`)) +select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where (t1.doc11.double between 1.1 and 9.9) and (t2.doc21.double between 2.2 and 11.11) and t1.doc11.double >= t2.doc21.double; +`doc11`.`double` `doc21`.`double` +2.2 2.2 +3.3 2.2 +5.5 2.2 +8.8 2.2 +8.8 6 +8.8 8.8 +explain extended select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > 'ggg'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_string doc21_string 5 NULL 3 100.00 Using where +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x20) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` > `test`.`t2`.`doc21`.`string`) and (`test`.`t2`.`doc21`.`string` > 'ggg')) +select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > 'ggg'; +`doc11`.`string` `doc21`.`string` +k hhh +k iii +explain extended select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.string between 'bbb' and 'iii') and (t2.doc21.string between 'aa' and 'kkk') and t1.doc11.string >= t2.doc21.string; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 2 100.00 Using where +1 SIMPLE t2 ALL doc21_string NULL NULL NULL 12 33.33 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` between 'bbb' and 'iii') and (`test`.`t2`.`doc21`.`string` between 'aa' and 'kkk') and (`test`.`t1`.`doc11`.`string` >= `test`.`t2`.`doc21`.`string`)) +select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.string between 'bbb' and 'iii') and (t2.doc21.string between 'aa' and 'kkk') and t1.doc11.string >= t2.doc21.string; +`doc11`.`string` `doc21`.`string` +eee aaaaaaa +hhh aaaaaaa +hhh false +hhh hhh +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > 10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_int doc21_int 9 NULL 2 100.00 Using where +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x8) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` > `test`.`t2`.`doc21`.`int`) and (`test`.`t2`.`doc21`.`int` > 10)) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > 10; +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` +44444 false 11.111 k +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_int doc21_int 9 NULL 2 100.00 Using where +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 33.33 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` between 3 and 8) and (`test`.`t2`.`doc21`.`int` between 7 and 9) and (`test`.`t1`.`doc11`.`int` > `test`.`t2`.`doc21`.`int`)) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` +8 hhh 7 NULL +explain extended select t1.doc11.bool, t1.doc11.string, t2.doc21.bool, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_bool doc21_bool 2 NULL 2 100.00 Using where +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x4) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` > `test`.`t2`.`doc21`.`bool`) and (`test`.`t2`.`doc21`.`bool` > 0)) +explain extended select t1.doc11.bool, t1.doc11.string, t2.doc21.bool, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.bool between 0 and 1) and (t2.doc21.bool between 1 and 2) and t1.doc11.bool >= t2.doc21.bool; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_bool doc21_bool 2 NULL 2 100.00 Using where +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 50.00 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` between 0 and 1) and (`test`.`t2`.`doc21`.`bool` between 1 and 2) and (`test`.`t1`.`doc11`.`bool` >= `test`.`t2`.`doc21`.`bool`)) +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 100.00 NULL +1 SIMPLE t2 ALL doc21_double NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x10) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where (`test`.`t1`.`doc11`.`double` > `test`.`t2`.`doc21`.`double`) +NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double; +`doc11`.`double` `doc11`.`string` `doc21`.`double` `doc21`.`string` +1 aaaaaaa false NULL +2.2 2.2 false NULL +2.2 2.2 1 aaaaaaa +2.2 2.2 true k +3.3 true false NULL +3.3 true 1 aaaaaaa +3.3 true true k +3.3 true 2.2 2.2 +5.5 eee false NULL +5.5 eee 1 aaaaaaa +5.5 eee true k +5.5 eee 2.2 2.2 +8.8 hhh 1 aaaaaaa +8.8 hhh 2.2 2.2 +8.8 hhh 6 NULL +8.8 hhh false NULL +8.8 hhh true k +10.1 1 aaaaaaa +10.1 2.2 2.2 +10.1 6 NULL +10.1 false NULL +10.1 8.8 hhh +10.1 9.9 iii +10.1 true k +true k false NULL +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > 1.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL doc21_double NULL NULL NULL 12 41.67 Using where +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x10) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` > `test`.`t2`.`doc21`.`double`) and (`test`.`t2`.`doc21`.`double` > 1.1)) +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > 1.1; +`doc11`.`double` `doc11`.`string` `doc21`.`double` `doc21`.`string` +3.3 true 2.2 2.2 +5.5 eee 2.2 2.2 +8.8 hhh 2.2 2.2 +10.1 2.2 2.2 +8.8 hhh 6 NULL +10.1 6 NULL +10.1 8.8 hhh +10.1 9.9 iii +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.double between 2.2 and 12.12) and (t2.doc21.double between 1.1 and 9.9) and t1.doc11.double >= t2.doc21.double; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL doc21_double NULL NULL NULL 12 33.33 Using where +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 41.67 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` between 2.2 and 12.12) and (`test`.`t2`.`doc21`.`double` between 1.1 and 9.9) and (`test`.`t1`.`doc11`.`double` >= `test`.`t2`.`doc21`.`double`)) +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.double between 2.2 and 12.12) and (t2.doc21.double between 1.1 and 9.9) and t1.doc11.double >= t2.doc21.double; +`doc11`.`double` `doc11`.`string` `doc21`.`double` `doc21`.`string` +2.2 2.2 2.2 2.2 +3.3 true 2.2 2.2 +5.5 eee 2.2 2.2 +8.8 hhh 2.2 2.2 +8.8 hhh 6 NULL +8.8 hhh 8.8 hhh +10.1 2.2 2.2 +10.1 6 NULL +10.1 8.8 hhh +10.1 9.9 iii +explain extended select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > 'ggg'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_string doc21_string 5 NULL 3 100.00 Using where +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x20) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` > `test`.`t2`.`doc21`.`string`) and (`test`.`t2`.`doc21`.`string` > 'ggg')) +select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > 'ggg'; +`doc11`.`string` `doc11`.`int` `doc21`.`string` `doc21`.`int` +k 11.111 hhh NULL +k 11.111 iii 9 +explain extended select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where (t1.doc11.string between 'bb' and 'ggg') and (t2.doc21.string between 'aaa' and 'kkk') and (t1.doc11.string >= t2.doc21.string); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 1 100.00 Using where +1 SIMPLE t2 ALL doc21_string NULL NULL NULL 12 33.33 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` between 'bb' and 'ggg') and (`test`.`t2`.`doc21`.`string` between 'aaa' and 'kkk') and (`test`.`t1`.`doc11`.`string` >= `test`.`t2`.`doc21`.`string`)) +select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where (t1.doc11.string between 'bb' and 'ggg') and (t2.doc21.string between 'aaa' and 'kkk') and (t1.doc11.string >= t2.doc21.string); +`doc11`.`string` `doc11`.`int` `doc21`.`string` `doc21`.`int` +eee 5 aaaaaaa 1 +explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index doc11_int doc11_int 9 NULL 12 100.00 Using where; Using index +1 SIMPLE t2 ref doc21_int doc21_int 9 test.t1.`doc11`.`int` 1 100.00 Using index +1 SIMPLE t3 ref doc31_int doc31_int 9 test.t1.`doc11`.`int` 1 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t2`.`doc21`.`int` = `test`.`t1`.`doc11`.`int`) and (`test`.`t3`.`doc31`.`int` = `test`.`t1`.`doc11`.`int`)) +select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; +`doc11`.`int` `doc21`.`int` `doc31`.`int` +1 1 1 +1 1 1 +10 10 10 +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 ref doc21_int doc21_int 9 test.t1.`doc11`.`int` 1 100.00 NULL +1 SIMPLE t3 ref doc31_int doc31_int 9 test.t1.`doc11`.`int` 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t2`.`doc21`.`int` = `test`.`t1`.`doc11`.`int`) and (`test`.`t3`.`doc31`.`int` = `test`.`t1`.`doc11`.`int`)) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` `doc31`.`int` `doc31`.`string` +true 2.2 1 aaaaaaa 1 aaa +true 2.2 true 2.2 1 aaa +10 10 10 jjj +explain extended select t1.doc11.bool, t1.doc11.string, t2.doc21.bool, t2.doc21.string, t3.doc31.bool, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.bool = t2.doc21.bool and t1.doc11.bool = t3.doc31.bool; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 100.00 NULL +1 SIMPLE t2 ALL doc21_bool NULL NULL NULL 12 75.00 Using where; Using join buffer (Block Nested Loop) +1 SIMPLE t3 ALL doc31_bool NULL NULL NULL 12 75.00 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`bool` AS "`doc31`.`bool`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t2`.`doc21`.`bool` = `test`.`t1`.`doc11`.`bool`) and (`test`.`t3`.`doc31`.`bool` = `test`.`t1`.`doc11`.`bool`)) +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string, t3.doc31.double, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double = t2.doc21.double and t1.doc11.double = t3.doc31.double; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 ref doc21_double doc21_double 9 test.t1.`doc11`.`double` 1 100.00 NULL +1 SIMPLE t3 ref doc31_double doc31_double 9 test.t1.`doc11`.`double` 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`double` AS "`doc31`.`double`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t2`.`doc21`.`double` = `test`.`t1`.`doc11`.`double`) and (`test`.`t3`.`doc31`.`double` = `test`.`t1`.`doc11`.`double`)) +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string, t3.doc31.double, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double = t2.doc21.double and t1.doc11.double = t3.doc31.double; +`doc11`.`double` `doc11`.`string` `doc21`.`double` `doc21`.`string` `doc31`.`double` `doc31`.`string` +2.2 2.2 2.2 2.2 2.2 bbb +8.8 hhh 8.8 hhh 8.8 hhh +10.1 10.1 10.1 jjj +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string = t2.doc21.string and t1.doc11.string = t3.doc31.string; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 ref doc21_string doc21_string 5 test.t1.`doc11`.`string` 1 100.00 NULL +1 SIMPLE t3 ref doc31_string doc31_string 6 test.t1.`doc11`.`string` 1 100.00 NULL +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t2`.`doc21`.`string` = `test`.`t1`.`doc11`.`string`) and (`test`.`t3`.`doc31`.`string` = `test`.`t1`.`doc11`.`string`)) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string = t2.doc21.string and t1.doc11.string = t3.doc31.string; +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` `doc31`.`int` `doc31`.`string` +NULL aaaaaaa 1 aaaaaaa 1 aaa +8 hhh NULL hhh 8 hhh +explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_int doc31_int 9 NULL 1 100.00 Using where; Using index +1 SIMPLE t1 index doc11_int doc11_int 9 NULL 12 100.00 Using index; Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_int NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x8) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` > `test`.`t2`.`doc21`.`int`) and (`test`.`t2`.`doc21`.`int` > `test`.`t3`.`doc31`.`int`) and (`test`.`t3`.`doc31`.`int` > 10)) +select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; +`doc11`.`int` `doc21`.`int` `doc31`.`int` +explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.int between 1 and 12) and (t2.doc21.int between 2 and 10) and (t3.doc31.int between 2 and 9) +and (t1.doc11.int <= t2.doc21.int and t2.doc21.int <= t3.doc31.int); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_int doc31_int 9 NULL 2 100.00 Using where; Using index +1 SIMPLE t2 range doc21_int doc21_int 9 NULL 4 100.00 Using where; Using index; Using join buffer (Block Nested Loop) +1 SIMPLE t1 range doc11_int doc11_int 9 NULL 7 100.00 Using where; Using index; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` between 1 and 12) and (`test`.`t2`.`doc21`.`int` between 2 and 10) and (`test`.`t3`.`doc31`.`int` between 2 and 9) and (`test`.`t1`.`doc11`.`int` <= `test`.`t2`.`doc21`.`int`) and (`test`.`t2`.`doc21`.`int` <= `test`.`t3`.`doc31`.`int`)) +select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.int between 1 and 12) and (t2.doc21.int between 2 and 10) and (t3.doc31.int between 2 and 9) +and (t1.doc11.int <= t2.doc21.int and t2.doc21.int <= t3.doc31.int); +`doc11`.`int` `doc21`.`int` `doc31`.`int` +1 4 8 +1 7 8 +3 4 8 +3 7 8 +5 7 8 +7 7 8 +explain extended select t1.doc11.bool, t2.doc21.bool, t3.doc31.bool +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > t3.doc31.bool and t3.doc31.bool > 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 index doc31_bool doc31_bool 2 NULL 12 16.67 Using where; Using index +1 SIMPLE t1 index doc11_bool doc11_bool 2 NULL 12 100.00 Using index; Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_bool NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x4) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`",`test`.`t3`.`doc31`.`bool` AS "`doc31`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` > `test`.`t2`.`doc21`.`bool`) and (`test`.`t2`.`doc21`.`bool` > `test`.`t3`.`doc31`.`bool`) and (`test`.`t3`.`doc31`.`bool` > 0)) +explain extended select t1.doc11.bool, t2.doc21.bool, t3.doc31.bool +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.bool between 1 and 2) and (t2.doc21.bool between 1 and 2) and (t3.doc31.bool between 0 and 1) +and (t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > t3.doc31.bool); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where; Using index +1 SIMPLE t3 range doc31_bool doc31_bool 2 NULL 4 100.00 Using where; Using index; Using join buffer (Block Nested Loop) +1 SIMPLE t2 index doc21_bool doc21_bool 2 NULL 12 16.67 Using where; Using index; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`",`test`.`t3`.`doc31`.`bool` AS "`doc31`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` between 1 and 2) and (`test`.`t2`.`doc21`.`bool` between 1 and 2) and (`test`.`t3`.`doc31`.`bool` between 0 and 1) and (`test`.`t1`.`doc11`.`bool` > `test`.`t2`.`doc21`.`bool`) and (`test`.`t2`.`doc21`.`bool` > `test`.`t3`.`doc31`.`bool`)) +explain extended select t1.doc11.double, t2.doc21.double, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double and t3.doc31.double > 10.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_double doc31_double 9 NULL 1 100.00 Using where; Using index +1 SIMPLE t1 index doc11_double doc11_double 9 NULL 12 100.00 Using index; Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_double NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x10) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t3`.`doc31`.`double` AS "`doc31`.`double`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` > `test`.`t2`.`doc21`.`double`) and (`test`.`t2`.`doc21`.`double` > `test`.`t3`.`doc31`.`double`) and (`test`.`t3`.`doc31`.`double` > 10.1)) +NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t2.doc21.double, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double and t3.doc31.double > 10.5; +`doc11`.`double` `doc21`.`double` `doc31`.`double` +explain extended select t1.doc11.double, t2.doc21.double, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.double between 0.1 and 99.9) and (t2.doc21.double between 1.1 and 11.11) and (t3.doc31.double between 2.2 and 12.12) +and (t1.doc11.double <= t2.doc21.double and t2.doc21.double <= t3.doc31.double); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_double doc31_double 9 NULL 3 100.00 Using where; Using index +1 SIMPLE t2 range doc21_double doc21_double 9 NULL 5 100.00 Using where; Using index; Using join buffer (Block Nested Loop) +1 SIMPLE t1 range doc11_double doc11_double 9 NULL 7 100.00 Using where; Using index; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t3`.`doc31`.`double` AS "`doc31`.`double`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` between 0.1 and 99.9) and (`test`.`t2`.`doc21`.`double` between 1.1 and 11.11) and (`test`.`t3`.`doc31`.`double` between 2.2 and 12.12) and (`test`.`t1`.`doc11`.`double` <= `test`.`t2`.`doc21`.`double`) and (`test`.`t2`.`doc21`.`double` <= `test`.`t3`.`doc31`.`double`)) +select t1.doc11.double, t2.doc21.double, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.double between 0.1 and 99.9) and (t2.doc21.double between 1.1 and 11.11) and (t3.doc31.double between 2.2 and 12.12) +and (t1.doc11.double <= t2.doc21.double and t2.doc21.double <= t3.doc31.double); +`doc11`.`double` `doc21`.`double` `doc31`.`double` +1 2.2 2.2 +1 2.2 8.8 +1 2.2 10.1 +1 6 8.8 +1 6 10.1 +1 8.8 8.8 +1 8.8 10.1 +1 9.9 10.1 +1 10.1 10.1 +1 2.2 2.2 +1 2.2 8.8 +1 2.2 10.1 +1 6 8.8 +1 6 10.1 +1 8.8 8.8 +1 8.8 10.1 +1 9.9 10.1 +1 10.1 10.1 +2.2 2.2 2.2 +2.2 2.2 8.8 +2.2 2.2 10.1 +2.2 6 8.8 +2.2 6 10.1 +2.2 8.8 8.8 +2.2 8.8 10.1 +2.2 9.9 10.1 +2.2 10.1 10.1 +3.3 6 8.8 +3.3 6 10.1 +3.3 8.8 8.8 +3.3 8.8 10.1 +3.3 9.9 10.1 +3.3 10.1 10.1 +5.5 6 8.8 +5.5 6 10.1 +5.5 8.8 8.8 +5.5 8.8 10.1 +5.5 9.9 10.1 +5.5 10.1 10.1 +8.8 8.8 8.8 +8.8 8.8 10.1 +8.8 9.9 10.1 +8.8 10.1 10.1 +10.1 10.1 10.1 +explain extended select t1.doc11.string, t2.doc21.string, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string >= t2.doc21.string and t2.doc21.string >= t3.doc31.string and t3.doc31.string >= 'aa'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 ALL doc31_string NULL NULL NULL 12 33.33 Using where +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 100.00 Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_string NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x20) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` >= `test`.`t2`.`doc21`.`string`) and (`test`.`t2`.`doc21`.`string` >= `test`.`t3`.`doc31`.`string`) and (`test`.`t3`.`doc31`.`string` >= 'aa')) +select t1.doc11.string, t2.doc21.string, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string >= t2.doc21.string and t2.doc21.string >= t3.doc31.string and t3.doc31.string >= 'aa'; +`doc11`.`string` `doc21`.`string` `doc31`.`string` +aaaaaaa aaaaaaa aaa +eee aaaaaaa aaa +hhh aaaaaaa aaa +hhh hhh aaa +hhh hhh bbb +hhh hhh hhh +k aaaaaaa aaa +k false aaa +k hhh aaa +k iii aaa +k k aaa +k hhh bbb +k iii bbb +k k bbb +k hhh hhh +k iii hhh +k k hhh +k k jjj +explain extended select t1.doc11.string, t2.doc21.string, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.string between 'a' and 'xxx') and (t2.doc21.string between 'aa' and 'kkk') and (t3.doc31.string between 'aaa' and 'jjj') +and (t1.doc11.string >= t2.doc21.string and t2.doc21.string >= t3.doc31.string); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 33.33 Using where +1 SIMPLE t2 ALL doc21_string NULL NULL NULL 12 33.33 Using where; Using join buffer (Block Nested Loop) +1 SIMPLE t3 ALL doc31_string NULL NULL NULL 12 33.33 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` between 'a' and 'xxx') and (`test`.`t2`.`doc21`.`string` between 'aa' and 'kkk') and (`test`.`t3`.`doc31`.`string` between 'aaa' and 'jjj') and (`test`.`t1`.`doc11`.`string` >= `test`.`t2`.`doc21`.`string`) and (`test`.`t2`.`doc21`.`string` >= `test`.`t3`.`doc31`.`string`)) +select t1.doc11.string, t2.doc21.string, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.string between 'a' and 'xxx') and (t2.doc21.string between 'aa' and 'kkk') and (t3.doc31.string between 'aaa' and 'jjj') +and (t1.doc11.string >= t2.doc21.string and t2.doc21.string >= t3.doc31.string); +`doc11`.`string` `doc21`.`string` `doc31`.`string` +aaaaaaa aaaaaaa aaa +true aaaaaaa aaa +false aaaaaaa aaa +eee aaaaaaa aaa +hhh aaaaaaa aaa +k aaaaaaa aaa +true false aaa +false false aaa +hhh false aaa +k false aaa +true hhh aaa +hhh hhh aaa +k hhh aaa +true iii aaa +k iii aaa +true k aaa +k k aaa +true false bbb +false false bbb +hhh false bbb +k false bbb +true hhh bbb +hhh hhh bbb +k hhh bbb +true iii bbb +k iii bbb +true k bbb +k k bbb +true hhh hhh +hhh hhh hhh +k hhh hhh +true iii hhh +k iii hhh +true k hhh +k k hhh +true k jjj +k k jjj +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_int doc31_int 9 NULL 1 100.00 Using where +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 100.00 Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_int NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x8) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` > `test`.`t2`.`doc21`.`int`) and (`test`.`t2`.`doc21`.`int` > `test`.`t3`.`doc31`.`int`) and (`test`.`t3`.`doc31`.`int` > 10)) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` `doc31`.`int` `doc31`.`string` +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.int between 0 and 13) and (t2.doc21.int between 1 and 12) and (t3.doc31.int between 2 and 11) +and (t1.doc11.int >= t2.doc21.int and t2.doc21.int >= t3.doc31.int); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_int doc31_int 9 NULL 3 100.00 Using where +1 SIMPLE t2 ALL doc21_int NULL NULL NULL 12 58.33 Using where; Using join buffer (Block Nested Loop) +1 SIMPLE t1 ALL doc11_int NULL NULL NULL 12 66.67 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`int` between 0 and 13) and (`test`.`t2`.`doc21`.`int` between 1 and 12) and (`test`.`t3`.`doc31`.`int` between 2 and 11) and (`test`.`t1`.`doc11`.`int` >= `test`.`t2`.`doc21`.`int`) and (`test`.`t2`.`doc21`.`int` >= `test`.`t3`.`doc31`.`int`)) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.int between 0 and 13) and (t2.doc21.int between 1 and 12) and (t3.doc31.int between 2 and 11) +and (t1.doc11.int >= t2.doc21.int and t2.doc21.int >= t3.doc31.int); +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` `doc31`.`int` `doc31`.`string` +5 eee 4 false 2 bbb +7.777 NULL 4 false 2 bbb +7.777 NULL 7 NULL 2 bbb +8 hhh 4 false 2 bbb +8 hhh 7 NULL 2 bbb +10 4 false 2 bbb +10 7 NULL 2 bbb +10 9 iii 2 bbb +10 9 iii 8 hhh +10 10 2 bbb +10 10 8 hhh +10 10 10 jjj +11.111 k 4 false 2 bbb +11.111 k 7 NULL 2 bbb +11.111 k 9 iii 2 bbb +11.111 k 9 iii 8 hhh +11.111 k 10 2 bbb +11.111 k 10 8 hhh +11.111 k 10 10 jjj +11.111 k 11.111 k 2 bbb +11.111 k 11.111 k 8 hhh +11.111 k 11.111 k 10 jjj +explain extended select t1.doc11.int, t1.doc11.bool, t2.doc21.int, t2.doc21.bool, t3.doc31.int, t3.doc31.bool +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > t3.doc31.bool and t3.doc31.bool > 0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_bool doc31_bool 2 NULL 2 100.00 Using where +1 SIMPLE t1 ALL doc11_bool NULL NULL NULL 12 100.00 Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_bool NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x4) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`bool` AS "`doc31`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` > `test`.`t2`.`doc21`.`bool`) and (`test`.`t2`.`doc21`.`bool` > `test`.`t3`.`doc31`.`bool`) and (`test`.`t3`.`doc31`.`bool` > 0)) +explain extended select t1.doc11.int, t1.doc11.bool, t2.doc21.int, t2.doc21.bool, t3.doc31.int, t3.doc31.bool +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.bool between 1 and 2) and (t2.doc21.bool between 1 and 2) and (t3.doc31.bool between 0 and 1) +and (t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > t3.doc31.bool); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range doc21_bool doc21_bool 2 NULL 2 100.00 Using where +1 SIMPLE t1 range doc11_bool doc11_bool 2 NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +1 SIMPLE t3 ALL doc31_bool NULL NULL NULL 12 33.33 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`bool` AS "`doc11`.`bool`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`bool` AS "`doc21`.`bool`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`bool` AS "`doc31`.`bool`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`bool` between 1 and 2) and (`test`.`t2`.`doc21`.`bool` between 1 and 2) and (`test`.`t3`.`doc31`.`bool` between 0 and 1) and (`test`.`t1`.`doc11`.`bool` > `test`.`t2`.`doc21`.`bool`) and (`test`.`t2`.`doc21`.`bool` > `test`.`t3`.`doc31`.`bool`)) +explain extended select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double and t3.doc31.double > 10.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_double doc31_double 9 NULL 1 100.00 Using where +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 100.00 Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_double NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x10) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`double` AS "`doc31`.`double`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` > `test`.`t2`.`doc21`.`double`) and (`test`.`t2`.`doc21`.`double` > `test`.`t3`.`doc31`.`double`) and (`test`.`t3`.`doc31`.`double` > 10.1)) +NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double and t3.doc31.double > 10.5; +`doc11`.`int` `doc11`.`double` `doc21`.`int` `doc21`.`double` `doc31`.`int` `doc31`.`double` +explain extended select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.double between 1.1 and 11.11) and (t2.doc21.double between 2.1 and 12.12) and (t3.doc31.double between 2.2 and 10.10) +and (t1.doc11.double <= t2.doc21.double and t2.doc21.double <= t3.doc31.double); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_double doc31_double 9 NULL 3 100.00 Using where +1 SIMPLE t1 ALL doc11_double NULL NULL NULL 12 41.67 Using where; Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_double NULL NULL NULL 12 41.67 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`double` AS "`doc11`.`double`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`double` AS "`doc21`.`double`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`double` AS "`doc31`.`double`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`double` between 1.1 and 11.11) and (`test`.`t2`.`doc21`.`double` between 2.1 and 12.12) and (`test`.`t3`.`doc31`.`double` between 2.2 and 10.10) and (`test`.`t1`.`doc11`.`double` <= `test`.`t2`.`doc21`.`double`) and (`test`.`t2`.`doc21`.`double` <= `test`.`t3`.`doc31`.`double`)) +select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.double between 1.1 and 11.11) and (t2.doc21.double between 2.1 and 12.12) and (t3.doc31.double between 2.2 and 10.10) +and (t1.doc11.double <= t2.doc21.double and t2.doc21.double <= t3.doc31.double); +`doc11`.`int` `doc11`.`double` `doc21`.`int` `doc21`.`double` `doc31`.`int` `doc31`.`double` +true 2.2 true 2.2 2 2.2 +true 2.2 true 2.2 8 8.8 +true 2.2 true 2.2 10 10.1 +true 2.2 66666 6 8 8.8 +true 2.2 66666 6 10 10.1 +3 3.3 66666 6 8 8.8 +3 3.3 66666 6 10 10.1 +5 5.5 66666 6 8 8.8 +5 5.5 66666 6 10 10.1 +true 2.2 NULL 8.8 8 8.8 +true 2.2 NULL 8.8 10 10.1 +3 3.3 NULL 8.8 8 8.8 +3 3.3 NULL 8.8 10 10.1 +5 5.5 NULL 8.8 8 8.8 +5 5.5 NULL 8.8 10 10.1 +8 8.8 NULL 8.8 8 8.8 +8 8.8 NULL 8.8 10 10.1 +true 2.2 9 9.9 10 10.1 +3 3.3 9 9.9 10 10.1 +5 5.5 9 9.9 10 10.1 +8 8.8 9 9.9 10 10.1 +true 2.2 10 10.1 10 10.1 +3 3.3 10 10.1 10 10.1 +5 5.5 10 10.1 10 10.1 +8 8.8 10 10.1 10 10.1 +10 10.1 10 10.1 10 10.1 +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > t3.doc31.string and t3.doc31.string > 'ggg'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 range doc31_string doc31_string 6 NULL 2 100.00 Using where +1 SIMPLE t1 ALL doc11_string NULL NULL NULL 12 100.00 Using join buffer (Block Nested Loop) +1 SIMPLE t2 ALL doc21_string NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x20) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` > `test`.`t2`.`doc21`.`string`) and (`test`.`t2`.`doc21`.`string` > `test`.`t3`.`doc31`.`string`) and (`test`.`t3`.`doc31`.`string` > 'ggg')) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > t3.doc31.string and t3.doc31.string > 'ggg'; +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` `doc31`.`int` `doc31`.`string` +11.111 k 9 iii 8 hhh +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.string between 'a' and 'jjj') and (t2.doc21.string between 'aa' and 'iii') and (t3.doc31.string between 'aaa' and 'kkk') +and (t1.doc11.string <= t2.doc21.string and t2.doc21.string <= t3.doc31.string); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range doc11_string doc11_string 6 NULL 3 100.00 Using where +1 SIMPLE t2 range doc21_string doc21_string 5 NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +1 SIMPLE t3 ALL doc31_string NULL NULL NULL 12 33.33 Using where; Using join buffer (Block Nested Loop) +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`doc11`.`int` AS "`doc11`.`int`",`test`.`t1`.`doc11`.`string` AS "`doc11`.`string`",`test`.`t2`.`doc21`.`int` AS "`doc21`.`int`",`test`.`t2`.`doc21`.`string` AS "`doc21`.`string`",`test`.`t3`.`doc31`.`int` AS "`doc31`.`int`",`test`.`t3`.`doc31`.`string` AS "`doc31`.`string`" from `test`.`t1` USE DOCUMENT INDEXES join `test`.`t2` USE DOCUMENT INDEXES join `test`.`t3` USE DOCUMENT INDEXES where ((`test`.`t1`.`doc11`.`string` between 'a' and 'jjj') and (`test`.`t2`.`doc21`.`string` between 'aa' and 'iii') and (`test`.`t3`.`doc31`.`string` between 'aaa' and 'kkk') and (`test`.`t1`.`doc11`.`string` <= `test`.`t2`.`doc21`.`string`) and (`test`.`t2`.`doc21`.`string` <= `test`.`t3`.`doc31`.`string`)) +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.string between 'a' and 'jjj') and (t2.doc21.string between 'aa' and 'iii') and (t3.doc31.string between 'aaa' and 'kkk') +and (t1.doc11.string <= t2.doc21.string and t2.doc21.string <= t3.doc31.string); +`doc11`.`int` `doc11`.`string` `doc21`.`int` `doc21`.`string` `doc31`.`int` `doc31`.`string` +NULL aaaaaaa 1 aaaaaaa 2 bbb +NULL aaaaaaa 1 aaaaaaa 8 hhh +NULL aaaaaaa NULL hhh 8 hhh +5 eee NULL hhh 8 hhh +8 hhh NULL hhh 8 hhh +NULL aaaaaaa 1 aaaaaaa 10 jjj +NULL aaaaaaa NULL hhh 10 jjj +5 eee NULL hhh 10 jjj +8 hhh NULL hhh 10 jjj +NULL aaaaaaa 9 iii 10 jjj +5 eee 9 iii 10 jjj +8 hhh 9 iii 10 jjj +drop table t1, t2, t3; include/rpl_end.inc diff --git a/mysql-test/suite/json/r/type_document_path_partial_update.result b/mysql-test/suite/json/r/type_document_path_partial_update.result index d3331a226a9c..97d1de7ffa8e 100644 --- a/mysql-test/suite/json/r/type_document_path_partial_update.result +++ b/mysql-test/suite/json/r/type_document_path_partial_update.result @@ -117,7 +117,7 @@ insert into t1 set a = 111, b = '@10', t1.doc = '{"id":200,"name":"Alex Smola"}' select * from t1 where a = 10 or a = 111; a b doc 10 @10 {"id":110,"name":"Snoopy","Children":"Unknown"} -10 @9 NULL +10 @9 {"id":200} 111 @10 {"id":200,"name":"Alex Smola"} update t1 set doc.id = null where a = 111; select * from t1 where a = 111; @@ -239,7 +239,7 @@ update t3 set t3.a = 456, t3.doc.c = 789; select * from t3; a b doc 456 NULL {"a":123,"b":null,"c":789} -456 NULL NULL +456 NULL {"c":789} update t2 set t2.doc.Children.noSuchFunction(1,2,3); ERROR 42000: Unknown procedure 'noSuchFunction' update t2 set t2.doc.Children.insertAt("ABC"); diff --git a/mysql-test/suite/json/t/type_document_path_optimizer.test b/mysql-test/suite/json/t/type_document_path_optimizer.test index 39f44a1905a8..f76e84da0d7b 100644 --- a/mysql-test/suite/json/t/type_document_path_optimizer.test +++ b/mysql-test/suite/json/t/type_document_path_optimizer.test @@ -1,60 +1,176 @@ +--source include/have_innodb.inc +--source include/have_innodb_16k.inc --source include/master-slave.inc connection master; +################################################################################ ### ### Test of query optimization on document path indexes ### --disable_warnings -drop table if exists t1, t2, t3, t4; +drop table if exists t1, t2, t3; --enable_warnings +## +## t1, t2, and t3 have identical schemas except the names +## + create table t1 ( - a int primary key, - b int, - c double, - d char(100), - doc1 document, - doc2 document, + a1 int primary key, + b1 int, + c1 double, + d1 char(10), + doc11 document, + doc12 document default null, # regular keys - key b_a (b, a), + key b1_a1 (b1, a1), # single column keys - key doc1_bool (doc1.bool as bool), - key doc1_int (doc1.int as int), - key doc1_double (doc1.double as double), - key doc1_string (doc1.string as string(100)), - key doc1_nested (doc1.k1.k2.k3.int as int), - key doc2_int (doc2.int as int), - key doc2_double (doc2.double as double), + key doc11_bool (doc11.bool as bool), + key doc11_int (doc11.int as int), + key doc11_double (doc11.double as double), + key doc11_string (doc11.string as string(3)), + key doc11_nested (doc11.k1.k2.k3.int as int), + key doc12_int (doc12.int as int), + key doc12_double (doc12.double as double), # multi-column keys - key doc1_b (doc1.int as int, b), - key doc1_c (doc1.double as double, c), - key doc1_d (doc1.int as int, d), - key b_doc1 (b, doc1.int as int) + key doc11_b1 (doc11.int as int, b1), + key doc11_c1 (doc11.double as double, c1), + key doc11_d1 (doc11.int as int, d1), + key b1_doc11 (b1, doc11.int as int) ) engine = innodb; +create table t2 ( + a2 int primary key, + b2 int, + c2 double, + d2 char(10), + doc21 document, + doc22 document, + + # regular keys + key b2_a2 (b2, a2), + + # single column keys + key doc21_bool (doc21.bool as bool), + key doc21_int (doc21.int as int), + key doc21_double (doc21.double as double), + key doc21_string (doc21.string as string(2)), + key doc21_nested (doc21.k1.k2.k3.int as int), + key doc22_int (doc22.int as int), + key doc22_double (doc22.double as double), + + # multi-column keys + key doc21_b2 (doc21.int as int, b2), + key doc21_c2 (doc21.double as double, c2), + key doc21_d2 (doc21.int as int, d2), + key b2_doc21 (b2, doc21.int as int) +) engine = innodb; + +create table t3 ( + a3 int primary key, + b3 int, + c3 double, + d3 char(10), + doc31 document, + doc32 document, + + # regular keys + key b3_a3 (b3, a3), + + # single column keys + key doc31_bool (doc31.bool as bool), + key doc31_int (doc31.int as int), + key doc31_double (doc31.double as double), + key doc31_string (doc31.string as string(3)), + key doc31_nested (doc31.k1.k2.k3.int as int), + key doc32_int (doc32.int as int), + key doc32_double (doc32.double as double), + + # multi-column keys + key doc31_b3 (doc31.int as int, b3), + key doc31_c3 (doc31.double as double, c3), + key doc31_d3 (doc31.int as int, d3), + key b3_doc31 (b3, doc31.int as int) +) engine = innodb; + + +## +## t1: both doc11 and doc12 have null documents, non-existence document paths, and unexpected types +## + insert into t1 values -(10, 10, 10.1, 'jjj', '{"bool":false, "int":10, "double":10.1, "string":"jjj", "k1":{"k2":{"k3":{"int":10}}}, "id":10}', '{"int":10, "double":10.1}'), -(11, 11, 11.11, 'kkk', '{"bool":false, "int":11, "double":11.11, "string":"kkk", "k1":{"k2":{"k3":{"int":11}}}, "id":11}', '{"int":11, "double":11.11}'), -(12, 12, 12.12, 'lll', '{"bool":false, "int":12, "double":12.12, "string":"lll", "k1":{"k2":{"k3":{"int":12}}}, "id":12}', '{"int":12, "double":12.12}'), -(1, 1, 1.1, 'aaa', '{"bool":true, "int":1, "double":1.1, "string":"aaa", "k1":{"k2":{"k3":{"int":1}}}, "id":1}', '{"int":1, "double":1.1}'), -(2, 2, 2.2, 'bbb', '{"bool":true, "int":2, "double":2.2, "string":"bbb", "k1":{"k2":{"k3":{"int":2}}}, "id":2}', '{"int":2, "double":2.2}'), -(3, 3, 3.3, 'ccc', '{"bool":true, "int":3, "double":3.3, "string":"ccc", "k1":{"k2":{"k3":{"int":3}}}, "id":3}', '{"int":3, "double":3.3}'), -(4, 4, 4.4, 'ddd', '{"bool":true, "int":4, "double":4.4, "string":"ddd", "k1":{"k2":{"k3":{"int":4}}}, "id":4}', '{"int":4, "double":4.4}'), -(5, 5, 5.5, 'eee', '{"bool":true, "int":5, "double":5.5, "string":"eee", "k1":{"k2":{"k3":{"int":5}}}, "id":5}', '{"int":5, "double":5.5}'), -(6, 6, 6.6, 'fff', '{"bool":false, "int":6, "double":6.6, "string":"fff", "k1":{"k2":{"k3":{"int":6}}}, "id":6}', '{"int":6, "double":6.6}'), -(7, 7, 7.7, 'ggg', '{"bool":false, "int":7, "double":7.7, "string":"ggg", "k1":{"k2":{"k3":{"int":7}}}, "id":7}', '{"int":7, "double":7.7}'), -(8, 8, 8.8, 'hhh', '{"bool":false, "int":8, "double":8.8, "string":"hhh", "k1":{"k2":{"k3":{"int":8}}}, "id":8}', '{"int":8, "double":8.8}'), -(9, 9, 9.9, 'iii', '{"bool":false, "int":9, "double":9.9, "string":"iii", "k1":{"k2":{"k3":{"int":9}}}, "id":9}', '{"int":9, "double":9.9}'); +(10, 10, 10.1, 'jjj', '{"bool":false, "int":10, "double":"10.1", "string":"", "k1":{"k2":{"k3":{"int":10}}},"id":10}', '{"int":10, "double":10.1}'), +(11, 11, 11.11, 'kkk', '{"bool":0, "int":"11.111","double":true, "string":"k", "k1":{"k2":{"k3":{"int":11}}},"id":11}', '{"__t":11, "double":11.11}'), +(1, 1, 1.1, 'aaa', '{"bool":true, "__t":1, "double":1, "string":"aaaaaaa", "k1":{"k2":{"k3":{"int":1}}}, "id":1}', '{"int":1, "double":1.1}'), +(2, 2, 2.2, 'bbb', '{"bool":"bbb", "int":true, "double":"2.2", "string":2.2, "k1":{"k2":{"k3":{"int":2}}}, "id":2}', '{"int":2, "___ble":2.2}'), +(3, 3, 3.3, 'ccc', '{"__ol":true, "int":3, "double":3.3, "string":true, "k1":{"k2":{"k3":{"int":3}}}, "id":3}', '{"i__":3, "dou___":3.3}'), +(5, 5, 5.5, 'eee', '{"bool":false, "int":5, "double":5.5, "string":"eee", "k1":{"k2":{"k3":{"int":5}}}, "id":5}', '{"int":5, "double":5.5}'), +(8, 8, 8.8, 'hhh', '{"bool":123456789, "int":8, "double":8.8, "string":"hhh", "k1":{"k2":{"k3":{"int":8}}}, "id":8}', '{"int":8, "double":8.8}'), +(9, 9, 9.9, 'iii', '{"bool":null, "int":null, "double":null, "string":null, "k1":null}', null); + +insert into t1 (a1, b1, c1, d1, doc11) values +(12, 12, 12.12, 'lll', '{"bool":2.5, "int":false, "double":false, "string":12, "k1":{"k2":{"k3":{"int":12}}},"id":12}'), +(4, 4, 4.4, 'ddd', '{"bool":"ddddddd", "int":"44444", "___ble":4.4, "string":false, "k1":{"k2":{"k3":{"int":4}}}, "id":4}'), +(7, 7, 7.7, 'ggg', '{"bool":"", "int":7.777, "double":false, "___ing":"gg", "k1":{"k2":{"k3":{"int":7}}}, "id":7}'); + +insert into t1 (a1, b1, c1, d1) values +(6, 6, 6.6, 'fff'); analyze table t1; -# -# ACCESS METHODS EXPLAINED -# +## +## t2: both doc21 and doc22 have null documents, non-existence document paths, and unexpected types +## + +insert into t2 values +(10, 10, 10.1, 'jjj', '{"bool":false, "int":10, "double":"10.1", "string":"", "k1":{"k2":{"k3":{"int":10}}},"id":10}', '{"int":10, "double":10.1}'), +(11, 11, 11.11, 'kkk', '{"bool":0, "int":"11.111","double":true, "string":"k", "k1":{"k2":{"k3":{"int":11}}},"id":11}', '{"__t":11, "double":11.11}'), +(12, 12, 12.12, 'lll', null, null), +(1, 1, 1.1, 'aaa', '{"__ol":true, "int":1, "double":1, "string":"aaaaaaa", "k1":{"k2":{"k3":{"int":1}}}, "id":1}', '{"int":1, "double":1.1}'), +(2, 2, 2.2, 'bbb', '{"bool":"bbb", "int":true, "double":"2.2", "string":2.2, "k1":{"k2":{"k3":{"int":2}}}, "id":2}', '{"int":2, "___ble":2.2}'), +(3, 3, 3.3, 'ccc', '{"bool":true, "__t":3, "___ble":3.3, "string":true, "k1":{"k2":{"k3":{"int":3}}}, "id":3}', '{"i__":3, "dou___":3.3}'), +(4, 4, 4.4, 'ddd', '{"bool":"ddddddd", "int":4, "double":null, "string":false, "k1":{"k2":{"k3":{"int":4}}}, "id":4}', null), +(5, 5, 5.5, 'eee', null, '{"int":5, "double":5.5}'), +(6, 6, 6.6, 'fff', '{"bool":false, "int":"66666", "double":6, "string":null, "k1":{"k2":{"k3":{"int":6}}}, "id":6}', '{"int":6, "double":6.6}'), +(7, 7, 7.7, 'ggg', '{"bool":false, "int":7, "double":false, "___ing":"g", "k1":{"k2":{"k3":{"int":7}}}, "id":7}', null), +(8, 8, 8.8, 'hhh', '{"bool":123456789, "int":null, "double":8.8, "string":"hhh", "k1":{"k2":{"k3":{"int":8}}}, "id":8}', '{"int":8, "double":8.8}'), +(9, 9, 9.9, 'iii', '{"bool":false, "int":9, "double":9.9, "string":"iii", "k1":{"k2":{"k3":{"int":9}}}, "id":9}', '{"int":9, "double":9.9}'); + +analyze table t2; + +## +## t3: both of doc31 and doc32 are null in some rows +## + +insert into t3 values +(1, 1, 1.1, 'aaa', '{"bool":true, "int":1, "double":1.1, "string":"aaa", "k1":{"k2":{"k3":{"int":1}}}, "id":1}', '{"int":1, "double":1.1}'), +(2, 2, 2.2, 'bbb', '{"bool":false, "int":2, "double":2.2, "string":"bbb", "k1":{"k2":{"k3":{"int":2}}}, "id":2}', '{"int":2, "double":2.2}'), +(8, 8, 8.8, 'hhh', '{"bool":true, "int":8, "double":8.8, "string":"hhh", "k1":{"k2":{"k3":{"int":8}}}, "id":8}', '{"int":8, "double":8.8}'), +(10, 10, 10.1, 'jjj', '{"bool":false, "int":10, "double":10.1, "string":"jjj", "k1":{"k2":{"k3":{"int":10}}},"id":10}', '{"int":10, "double":10.1}'); + + +insert into t3 (a3, b3, c3, d3) values +(11, 11, 11.11, 'kkk'), +(12, 12, 12.12, 'lll'), +(3, 3, 3.3, 'ccc'), +(4, 4, 4.4, 'ddd'), +(5, 5, 5.5, 'eee'), +(6, 6, 6.6, 'fff'), +(7, 7, 7.7, 'ggg'), +(9, 9, 9.9, 'iii'); + + +analyze table t3; + + +################################################################################ +### +### ACCESS METHODS EXPLAINED +### # "select *" on a document table should always be full table scan explain extended select * from t1 use document keys; @@ -62,381 +178,1080 @@ select * from t1 use document keys; # "select doc" should always be full table scan as well # (i.e. no covering index on the whole document) -explain extended select doc1 from t1 use document keys; -select doc1 from t1 use document keys; -explain extended select doc2 from t1 use document keys; -select doc2 from t1 use document keys; +explain extended select doc11 from t1 use document keys; +select doc11 from t1 use document keys; +explain extended select doc12 from t1 use document keys; +select doc12 from t1 use document keys; + +################################################################################ +### +### NULL values with / without document indexes +### + +# document column +select a1 from t1 where doc11 is null; +select a1 from t1 where doc11 is not null; + +select a1 from t1 use document keys where doc11 is null; +select a1 from t1 use document keys where doc11 is not null; + +# bool +--echo FIXME!! This isn't necessarily a bug but it is confusing! +--echo The results of "is [not] null" with / without document key enabled can +--echo be different. The reason is that, with document keys disabled, there are +--echo no type for `doc11`.`bool` so as long as the document path exists and +--echo its value is not null, it will be treated as not null. But when document +--echo kyes are enabled, document path `doc11`.`bool` may pick up a type from +--echo document keys, e.g. Boolean type, and the document path values will be +--echo retrieved from that index instead of the original document, so even the +--echo value of the document path is not null in the document but it still can +--echo be null as Boolean type in index. e.g. {"bool":"key as bool will be null"}, +--echo so different results will be observed with the same query. + +explain extended select a1 from t1 where doc11.bool is null; +select a1 from t1 where doc11.bool is null; +select a1 from t1 where doc11.bool is not null; + +explain extended select a1 from t1 use document keys where doc11.bool is null; +select a1 from t1 use document keys where doc11.bool is null; +select a1 from t1 use document keys where doc11.bool is not null; + +# int +select a1 from t1 where doc11.int is null; +select a1 from t1 where doc11.int is not null; + +select a1 from t1 use document keys where doc11.int is null; +select a1 from t1 use document keys where doc11.int is not null; + +# double +select a1 from t1 where doc11.double is null; +select a1 from t1 where doc11.double is not null; + +select a1 from t1 use document keys where doc11.double is null; +select a1 from t1 use document keys where doc11.double is not null; + +# string +select a1 from t1 where doc11.string is null; +select a1 from t1 where doc11.string is not null; + +select a1 from t1 use document keys where doc11.string is null; +select a1 from t1 use document keys where doc11.string is not null; + + +################################################################################ +### +### Single-table Queries +### ## ## bool index type ## # -# covering index +# bool: covering index # -explain extended select a from t1 where doc1.bool is true; -select a from t1 where doc1.bool is true; -explain extended select a from t1 use document keys where doc1.bool is true; -select a from t1 use document keys where doc1.bool is true; -# group by -explain extended select count(a) from t1 use document keys group by doc1.bool; -select count(a) from t1 use document keys group by doc1.bool; -explain extended select sum(a) from t1 use document keys group by doc1.bool; -select sum(a) from t1 use document keys group by doc1.bool; -explain extended select avg(a) from t1 use document keys group by doc1.bool; -select avg(a) from t1 use document keys group by doc1.bool; - -explain extended select doc1.bool from t1 where doc1.bool is true; -select doc1.bool from t1 where doc1.bool is true; -explain extended select doc1.bool from t1 use document keys where doc1.bool is true; -select doc1.bool from t1 use document keys where doc1.bool is true; +explain extended select a1 from t1 where doc11.bool is true; +select a1 from t1 where doc11.bool is true; + +explain extended select a1 from t1 where doc11.bool is false; +select a1 from t1 where doc11.bool is false; + +explain extended select a1 from t1 use document keys where doc11.bool is true; +select a1 from t1 use document keys where doc11.bool is true; + +--echo FIXME!! (this isn't necessarily a bug): different results with / without indexes +explain extended select a1 from t1 use document keys where doc11.bool is false; +select a1 from t1 use document keys where doc11.bool is false; + +# +# bool: covering index for range queries +# + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0; +select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0; + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool < 1; +select t1.doc11.bool from t1 use document keys where t1.doc11.bool < 1; + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool < 1; +select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool < 1; + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool >= 0; +select t1.doc11.bool from t1 use document keys where t1.doc11.bool >= 0; + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool <= 1; +select t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool <= 1; + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool between 0 and 1; +select t1.doc11.bool from t1 use document keys where t1.doc11.bool between 0 and 1; + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool not between 0 and 1; +select t1.doc11.bool from t1 use document keys where t1.doc11.bool not between 0 and 1; + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0, 1); +select t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0, 1); + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0); +select t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0); + +explain extended select t1.doc11.bool from t1 use document keys where t1.doc11.bool not in (1); +select t1.doc11.bool from t1 use document keys where t1.doc11.bool not in (1); + +explain extended select t1.doc11.bool from t1 use document keys + where (t1.doc11.bool >= 0 and t1.doc11.bool <= 255) and (t1.doc11.bool not in (0)); +select t1.doc11.bool from t1 use document keys +where (t1.doc11.bool >= 0 and t1.doc11.bool <= 255) and (t1.doc11.bool not in (0)); + # group by -explain extended select count(doc1.bool) from t1 use document keys group by doc1.bool; -select count(doc1.bool) from t1 use document keys group by doc1.bool; -explain extended select sum(doc1.bool) from t1 use document keys group by doc1.bool; -select sum(doc1.bool) from t1 use document keys group by doc1.bool; -explain extended select avg(doc1.bool) from t1 use document keys group by doc1.bool; -select avg(doc1.bool) from t1 use document keys group by doc1.bool; +explain extended select count(a1) from t1 use document keys group by doc11.bool; +select count(a1) from t1 use document keys group by doc11.bool; + +explain extended select sum(a1) from t1 use document keys group by doc11.bool; +select sum(a1) from t1 use document keys group by doc11.bool; + +explain extended select avg(a1) from t1 use document keys group by doc11.bool; +select avg(a1) from t1 use document keys group by doc11.bool; + +explain extended select doc11.bool from t1 where doc11.bool is true; +select doc11.bool from t1 where doc11.bool is true; + +explain extended select doc11.bool from t1 use document keys where doc11.bool is true; +select doc11.bool from t1 use document keys where doc11.bool is true; + +explain extended select count(doc11.bool) from t1 use document keys group by doc11.bool; +select count(doc11.bool) from t1 use document keys group by doc11.bool; + +explain extended select sum(doc11.bool) from t1 use document keys group by doc11.bool; +select sum(doc11.bool) from t1 use document keys group by doc11.bool; + +explain extended select avg(doc11.bool) from t1 use document keys group by doc11.bool; +select avg(doc11.bool) from t1 use document keys group by doc11.bool; # doc_bool is the smallest secondary index to cover primary key -explain extended select a from t1; -select a from t1; -explain extended select a from t1 use document keys; -select a from t1 use document keys; + +explain extended select a1 from t1; +select a1 from t1; +explain extended select a1 from t1 use document keys; +select a1 from t1 use document keys; # -# non-covering +# bool: non-covering index for range queries # -explain extended select * from t1 where doc1.bool is true; -select * from t1 where doc1.bool is true; -explain extended select * from t1 use document keys where doc1.bool is true; -select * from t1 use document keys where doc1.bool is true; -# group by (count-star will do index scan) -explain extended select count(*) from t1 use document keys group by doc1.bool; -select count(*) from t1 use document keys group by doc1.bool; +explain extended select * from t1 where doc11.bool is true; +select * from t1 where doc11.bool is true; -explain extended select doc1 from t1 where doc1.bool is true; -select doc1 from t1 where doc1.bool is true; -explain extended select doc1 from t1 use document keys where doc1.bool is true; -select doc1 from t1 use document keys where doc1.bool is true; -# group by -explain extended select count(doc1) from t1 use document keys group by doc1.bool; -select count(doc1) from t1 use document keys group by doc1.bool; +explain extended select * from t1 use document keys where doc11.bool is true; +select * from t1 use document keys where doc11.bool is true; + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0; +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0; + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool < 1; +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool < 1; + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool < 1; +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool < 1; + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool >= 0; +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool >= 0; + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool <= 1; +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool > 0 and t1.doc11.bool <= 1; + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool between 0 and 1; +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool between 0 and 1; + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool not between 0 and 1; +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool not between 0 and 1; + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0, 1); +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0, 1); + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0); +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool in (0); + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool not in (1); +select t1.doc11.int, t1.doc11.bool from t1 use document keys where t1.doc11.bool not in (1); + +explain extended select t1.doc11.int, t1.doc11.bool from t1 use document keys + where (t1.doc11.bool >= 0 and t1.doc11.bool <= 255) and (t1.doc11.bool not in (0)); +select t1.doc11.int, t1.doc11.bool from t1 use document keys +where (t1.doc11.bool >= 0 and t1.doc11.bool <= 255) and (t1.doc11.bool not in (0)); -explain extended select doc1.int from t1 where doc1.bool is true; -select doc1.int from t1 where doc1.bool is true; -explain extended select doc1.int from t1 use document keys where doc1.bool is true; -select doc1.int from t1 use document keys where doc1.bool is true; # group by -explain extended select count(doc1.int) from t1 use document keys group by doc1.bool; -select count(doc1.int) from t1 use document keys group by doc1.bool; + +# index scan for count-star +explain extended select count(*) from t1 use document keys group by doc11.bool; +select count(*) from t1 use document keys group by doc11.bool; + +explain extended select doc11 from t1 where doc11.bool is true; +select doc11 from t1 where doc11.bool is true; + +explain extended select doc11 from t1 use document keys where doc11.bool is true; +select doc11 from t1 use document keys where doc11.bool is true; + +explain extended select count(doc11) from t1 use document keys group by doc11.bool; +select count(doc11) from t1 use document keys group by doc11.bool; + +explain extended select doc11.int from t1 where doc11.bool is true; +select doc11.int from t1 where doc11.bool is true; + +explain extended select doc11.int from t1 use document keys where doc11.bool is true; +select doc11.int from t1 use document keys where doc11.bool is true; + +explain extended select count(doc11.int) from t1 use document keys group by doc11.bool; +select count(doc11.int) from t1 use document keys group by doc11.bool; ## ## integer index type ## # -# covering index +# int: covering index for range queries # # on not-nullable document column -explain extended select a from t1 where doc1.int > 5; -select a from t1 where doc1.int > 5; -explain extended select a from t1 use document keys where doc1.int > 5; -select a from t1 use document keys where doc1.int > 5; +explain extended select a1 from t1 where doc11.int > 5; +select a1 from t1 where doc11.int > 5; + +explain extended select a1 from t1 use document keys where doc11.int > 5; +select a1 from t1 use document keys where doc11.int > 5; + +explain extended select doc11.int from t1 use document keys where doc11.int >= 5; +select doc11.int from t1 use document keys where doc11.int >= 5; + +# out of range +explain extended select a1 from t1 use document keys where doc11.int > 13; +select a1 from t1 use document keys where doc11.int > 13; + +explain extended select a1, doc11.int from t1 use document keys where doc11.int < 9; +select a1, doc11.int from t1 use document keys where doc11.int < 9; + +explain extended select doc11.int, a1 from t1 use document keys where doc11.int <= 9; +select doc11.int, a1 from t1 use document keys where doc11.int <= 9; + +# out of range +explain extended select doc11.int from t1 use document keys where doc11.int < 1; +select doc11.int from t1 use document keys where doc11.int < 1; + +explain extended select a1, doc11.int from t1 use document keys where doc11.int > 5 and doc11.int < 9; +select a1, doc11.int from t1 use document keys where doc11.int > 5 and doc11.int < 9; + +explain extended select a1 from t1 use document keys where doc11.int >= 5 and doc11.int <= 9; +select a1 from t1 use document keys where doc11.int >= 5 and doc11.int <= 9; + +explain extended select a1 from t1 use document keys where doc11.int > 0 and doc11.int < 130; +select a1 from t1 use document keys where doc11.int > 0 and doc11.int < 130; + +# between +explain extended select a1, doc11.int from t1 use document keys where doc11.int between 5 and 9; +select a1, doc11.int from t1 use document keys where doc11.int between 5 and 9; + +explain extended select doc11.int from t1 use document keys where doc11.int between 5 and 15; +select doc11.int from t1 use document keys where doc11.int between 5 and 15; + +# not between +explain extended select a1, doc11.int from t1 use document keys where doc11.int not between 5 and 9; +select a1, doc11.int from t1 use document keys where doc11.int not between 5 and 9; + +explain extended select a1, doc11.int from t1 use document keys where doc11.int not between 5 and 130; +select a1, doc11.int from t1 use document keys where doc11.int not between 5 and 130; + +# in +explain extended select a1, doc11.int from t1 use document keys where doc11.int in (5, 7, 9, 12); +select a1, doc11.int from t1 use document keys where doc11.int in (5, 7, 9, 12); + +explain extended select a1, doc11.int from t1 use document keys where doc11.int in (5, 100, 0); +select a1, doc11.int from t1 use document keys where doc11.int in (5, 100, 0); + +# not in +explain extended select a1, doc11.int from t1 use document keys where doc11.int not in (5, 7, 9, 12); +select a1, doc11.int from t1 use document keys where doc11.int not in (5, 7, 9, 12); + +explain extended select a1, doc11.int from t1 use document keys where doc11.int not in (0, 100, 5, 6, 7, 12, 11, 10); +select a1, doc11.int from t1 use document keys where doc11.int not in (0, 100, 5, 6, 7, 12, 11, 10); + +# multiple ranges without overlap +explain extended select doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int > 6 and doc11.int < 8 or + doc11.int > 9 and doc11.int < 11 or doc11.int >= 12 and doc11.int <= 15; + +select doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int > 6 and doc11.int < 8 or + doc11.int > 9 and doc11.int < 11 or doc11.int >= 12 and doc11.int <= 15; + +# multiple ranges with overlap +explain extended select doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 8 or doc11.int > 5 and doc11.int < 9 or + doc11.int > 7 and doc11.int <= 15 or doc11.int >= 12 and doc11.int < 15; + +select doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 8 or doc11.int > 5 and doc11.int < 9 or + doc11.int > 7 and doc11.int <= 15 or doc11.int >= 12 and doc11.int < 15; + +explain extended select doc11.int from t1 use document keys +where ((doc11.int > 3 and doc11.int < 8) and (doc11.int not between 6 and 9)) or + ((doc11.int between 11 and 15) and (doc11.int not in (4, 5))); + +select doc11.int from t1 use document keys +where ((doc11.int > 3 and doc11.int < 8) and (doc11.int not between 6 and 9)) or + ((doc11.int between 11 and 15) and (doc11.int not in (4, 5))); + # group by -explain extended select count(a) from t1 use document keys group by doc1.int having doc1.int > 5; -select count(a) from t1 use document keys group by doc1.int having doc1.int > 5; +explain extended select count(a1) from t1 use document keys group by doc11.int having doc11.int > 5; +select count(a1) from t1 use document keys group by doc11.int having doc11.int > 5; # order by -explain extended select a from t1 use document keys order by doc1.int; -select a from t1 use document keys order by doc1.int; +explain extended select a1 from t1 use document keys order by doc11.int; +select a1 from t1 use document keys order by doc11.int; -explain extended select a from t1 use document keys order by doc1.int as string; -select a from t1 use document keys order by doc1.int as string; -select a from t1 order by doc1.int as string; +explain extended select a1 from t1 use document keys order by doc11.int as string; +select a1 from t1 use document keys order by doc11.int as string; +select a1 from t1 order by doc11.int as string; -explain extended select b from t1 use document keys order by doc1.double as string; -select c from t1 use document keys order by doc1.double as string; -select c from t1 order by doc1.double as string; +explain extended select b1 from t1 use document keys order by doc11.double as string; +select c1 from t1 use document keys order by doc11.double as string; +select c1 from t1 order by doc11.double as string; + +explain extended select doc11.int from t1 where doc11.int > 5; +select doc11.int from t1 where doc11.int > 5; +explain extended select doc11.int from t1 use document keys where doc11.int > 5; +select doc11.int from t1 use document keys where doc11.int > 5; -explain extended select doc1.int from t1 where doc1.int > 5; -select doc1.int from t1 where doc1.int > 5; -explain extended select doc1.int from t1 use document keys where doc1.int > 5; -select doc1.int from t1 use document keys where doc1.int > 5; # group by -explain extended select count(doc1.int) from t1 use document keys group by doc1.int having doc1.int > 5 ; -select count(doc1.int) from t1 use document keys group by doc1.int having doc1.int > 5 ; +explain extended select count(doc11.int) from t1 use document keys group by doc11.int having doc11.int > 5 ; +select count(doc11.int) from t1 use document keys group by doc11.int having doc11.int > 5 ; + # group by with where clause -explain extended select count(doc1.int) from t1 use document keys where doc1.int > 5 group by doc1.int; -select count(doc1.int) from t1 use document keys where doc1.int > 5 group by doc1.int; -explain extended select count(a) from t1 use document keys where doc1.int = 5 group by doc1.int; -select count(a) from t1 use document keys where doc1.int = 5 group by doc1.int; +explain extended select count(doc11.int) from t1 use document keys where doc11.int > 5 group by doc11.int; +select count(doc11.int) from t1 use document keys where doc11.int > 5 group by doc11.int; +explain extended select count(a1) from t1 use document keys where doc11.int = 5 group by doc11.int; +select count(a1) from t1 use document keys where doc11.int = 5 group by doc11.int; # on nullable document column -explain extended select a from t1 where doc2.int > 5; -select a from t1 where doc2.int > 5; -explain extended select a from t1 use document keys where doc2.int > 5; -select a from t1 use document keys where doc2.int > 5; +explain extended select a1 from t1 where doc12.int > 5; +select a1 from t1 where doc12.int > 5; +explain extended select a1 from t1 use document keys where doc12.int > 5; +select a1 from t1 use document keys where doc12.int > 5; + # group by -explain extended select count(a) from t1 use document keys group by doc2.int having doc2.int > 5; -select count(a) from t1 use document keys group by doc2.int having doc2.int > 5; +explain extended select count(a1) from t1 use document keys group by doc12.int having doc12.int > 5; +select count(a1) from t1 use document keys group by doc12.int having doc12.int > 5; + +explain extended select doc12.int from t1 where doc12.int > 5; +select doc12.int from t1 where doc12.int > 5; +explain extended select doc12.int from t1 use document keys where doc12.int > 5; +select doc12.int from t1 use document keys where doc12.int > 5; -explain extended select doc2.int from t1 where doc2.int > 5; -select doc2.int from t1 where doc2.int > 5; -explain extended select doc2.int from t1 use document keys where doc2.int > 5; -select doc2.int from t1 use document keys where doc2.int > 5; # group by -explain extended select count(doc2.int) from t1 use document keys group by doc2.int having doc2.int > 5; -select count(doc2.int) from t1 use document keys group by doc2.int having doc2.int > 5; +explain extended select count(doc12.int) from t1 use document keys group by doc12.int having doc12.int > 5; +select count(doc12.int) from t1 use document keys group by doc12.int having doc12.int > 5; # -# non-covering +# int: non-covering index for range queries # -# on not-nullable document column -explain extended select * from t1 where doc1.int > 5; -select * from t1 where doc1.int > 5; -explain extended select * from t1 use document keys where doc1.int > 5; -select * from t1 use document keys where doc1.int > 5; -# group by -explain extended select count(*) from t1 use document keys group by doc1.int having doc1.int > 5; -select count(*) from t1 use document keys group by doc1.int having doc1.int > 5; +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int > 5; +select doc11.string, doc11.int from t1 use document keys where doc11.int > 5; -explain extended select doc1 from t1 where doc1.int > 5; -select doc1 from t1 where doc1.int > 5; -explain extended select doc1 from t1 use document keys where doc1.int > 5; -select doc1 from t1 use document keys where doc1.int > 5; -# group by -explain extended select count(doc1) from t1 use document keys group by doc1.int having doc1.int > 5; -select count(doc1) from t1 use document keys group by doc1.int having doc1.int > 5; +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int >= 5; +select doc11.string, doc11.int from t1 use document keys where doc11.int >= 5; -explain extended select doc1.double from t1 where doc1.int > 5; -select doc1.double from t1 where doc1.int > 5; -explain extended select doc1.double from t1 use document keys where doc1.int > 5; -select doc1.double from t1 use document keys where doc1.int > 5; +# out of range +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int > 13; +select doc11.string, doc11.int from t1 use document keys where doc11.int > 13; -# group by -explain extended select sum(doc1.double) from t1 use document keys group by doc1.int having doc1.int > 5; -select sum(doc1.double) from t1 use document keys group by doc1.int having doc1.int > 5; +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int < 9; +select doc11.string, doc11.int from t1 use document keys where doc11.int < 9; -# on nullable document column -explain extended select * from t1 where doc2.int > 5; -select * from t1 where doc2.int > 5; -explain extended select * from t1 use document keys where doc2.int > 5; -select * from t1 use document keys where doc2.int > 5; -# group by -explain extended select count(*) from t1 use document keys group by doc2.int having doc2.int > 5; -select count(*) from t1 use document keys group by doc2.int having doc2.int > 5; +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int <= 5; +select doc11.string, doc11.int from t1 use document keys where doc11.int <= 5; -explain extended select doc2 from t1 where doc2.int > 5; -select doc2 from t1 where doc2.int > 5; -explain extended select doc2 from t1 use document keys where doc2.int > 5; -select doc2 from t1 use document keys where doc2.int > 5; -# group by -explain extended select count(doc2) from t1 use document keys group by doc2.int having doc2.int > 5; -select count(doc2) from t1 use document keys group by doc2.int having doc2.int > 5; +# out of range +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int < 1; +select doc11.string, doc11.int from t1 use document keys where doc11.int < 1; -explain extended select doc2.double from t1 where doc2.int > 5; -select doc2.double from t1 where doc2.int > 5; -explain extended select doc2.double from t1 use document keys where doc2.int > 5; -select doc2.double from t1 use document keys where doc2.int > 5; -# group by -explain extended select sum(doc2.double) from t1 use document keys group by doc2.int having doc2.int > 5; -select sum(doc2.double) from t1 use document keys group by doc2.int having doc2.int > 5; +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int > 2 and doc11.int < 12; +select doc11.string, doc11.int from t1 use document keys where doc11.int > 2 and doc11.int < 12; + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int >= 5 and doc11.int <= 9; +select doc11.string, doc11.int from t1 use document keys where doc11.int >= 5 and doc11.int <= 9; + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int > 0 and doc11.int < 130; +select doc11.string, doc11.int from t1 use document keys where doc11.int > 0 and doc11.int < 130; + +# between +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int between 8 and 9; +select doc11.string, doc11.int from t1 use document keys where doc11.int between 5 and 9; + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int between 5 and 15; +select doc11.string, doc11.int from t1 use document keys where doc11.int between 5 and 15; + +# not between +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not between 8 and 9; +select doc11.string, doc11.int from t1 use document keys where doc11.int not between 8 and 9; + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not between 2 and 12; +select doc11.string, doc11.int from t1 use document keys where doc11.int not between 2 and 12; + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not between 5 and 130; +select doc11.string, doc11.int from t1 use document keys where doc11.int not between 5 and 130; + +# in +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int in (8); +select doc11.string, doc11.int from t1 use document keys where doc11.int in (8); + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 12); +select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 12); + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 7, 9, 12); +select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 7, 9, 12); + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 100, 0); +select doc11.string, doc11.int from t1 use document keys where doc11.int in (8, 100, 0); + +# not in +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not in (8, 7, 9, 12); +select doc11.string, doc11.int from t1 use document keys where doc11.int not in (8, 7, 9, 12); + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.int not in (0, 100, 5, 6, 7, 12, 11, 10); +select doc11.string, doc11.int from t1 use document keys where doc11.int not in (0, 100, 5, 6, 7, 12, 11, 10); + +# multiple ranges without overlap +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int >= 11 and doc11.int < 100; + +select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int >= 11 and doc11.int < 100; + +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int > 6 and doc11.int < 8 or + doc11.int > 9 and doc11.int < 11 or doc11.int >= 12 and doc11.int <= 15; + +select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 5 or doc11.int > 6 and doc11.int < 8 or + doc11.int > 9 and doc11.int < 11 or doc11.int >= 12 and doc11.int <= 15; + +# multiple ranges with overlap +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 8 or doc11.int > 5 and doc11.int < 9 or + doc11.int > 7 and doc11.int <= 15 or doc11.int >= 12 and doc11.int < 15; + +select doc11.string, doc11.int from t1 use document keys +where doc11.int > 3 and doc11.int < 8 or doc11.int > 5 and doc11.int < 9 or + doc11.int > 7 and doc11.int <= 15 or doc11.int >= 12 and doc11.int < 15; + +explain extended select doc11.string, doc11.int from t1 use document keys +where ((doc11.int > 3 and doc11.int < 8) and (doc11.int not between 6 and 9)) or + ((doc11.int between 11 and 15) and (doc11.int not in (4, 5))); + +select doc11.string, doc11.int from t1 use document keys +where ((doc11.int > 3 and doc11.int < 8) and (doc11.int not between 6 and 9)) or + ((doc11.int between 11 and 15) and (doc11.int not in (4, 5))); # select path is a prefix of the indexed document path -explain extended select doc1.k1.k2 from t1 where doc1.k1.k2.k3.int > 5; -select doc1.k1.k2 from t1 where doc1.k1.k2.k3.int > 5; -explain extended select doc1.k1.k2 from t1 use document keys where doc1.k1.k2.k3.int > 5; -select doc1.k1.k2 from t1 use document keys where doc1.k1.k2.k3.int > 5; -select doc1.k1.k2.k3 from t1 use document keys where doc1.k1.k2.k3.int > 5; -select doc1.k1.k2.k3.int.foo from t1 use document keys where doc1.k1.k2.k3.int > 5; +explain extended select doc11.k1.k2 from t1 where doc11.k1.k2.k3.int > 11; +select doc11.k1.k2 from t1 where doc11.k1.k2.k3.int > 11; + +explain extended select doc11.k1.k2 from t1 use document keys where doc11.k1.k2.k3.int > 11; +select doc11.k1.k2 from t1 use document keys where doc11.k1.k2.k3.int > 11; +select doc11.k1.k2.k3 from t1 use document keys where doc11.k1.k2.k3.int > 11; +select doc11.k1.k2.k3.int.foo from t1 use document keys where doc11.k1.k2.k3.int > 11; + # where condition is a prefix of the indexed document path -explain extended select doc1.k1.k2.k3.int from t1 use document keys where doc1.k1.k2.k3 > 5; -select doc1.k1.k2.k3.int from t1 use document keys where doc1.k1.k2.k3 > 5; +explain extended select doc11.k1.k2.k3.int from t1 use document keys where doc11.k1.k2.k3 > 11; +select doc11.k1.k2.k3.int from t1 use document keys where doc11.k1.k2.k3 > 11; + +# +# int: non-covering index for range queries with group by / order by +# + +# group by with having +--echo FIXME!! +explain extended select count(*) from t1 use document keys group by doc11.int having doc11.int > 5; +select count(*) from t1 use document keys group by doc11.int having doc11.int > 5; + +--echo FIXME!! +explain extended select count(doc11) from t1 use document keys group by doc11.int having doc11.int > 5; +select count(doc11) from t1 use document keys group by doc11.int having doc11.int > 5; + +--echo FIXME!! +explain extended select sum(doc11.double) from t1 use document keys group by doc11.int having doc11.int > 5; +select sum(doc11.double) from t1 use document keys group by doc11.int having doc11.int > 5; + +# group by with having on nullable document column +--echo FIXME!! +explain extended select count(*) from t1 use document keys group by doc12.int having doc12.int > 5; +select count(*) from t1 use document keys group by doc12.int having doc12.int > 5; + +--echo FIXME!! +explain extended select count(doc12) from t1 use document keys group by doc12.int having doc12.int > 5; +select count(doc12) from t1 use document keys group by doc12.int having doc12.int > 5; + +--echo FIXME!! +explain extended select sum(doc12.double) from t1 use document keys group by doc12.int having doc12.int > 5; +select sum(doc12.double) from t1 use document keys group by doc12.int having doc12.int > 5; ## ## double index type ## # -# covering index +# double: covering index # # on not-nullable document column -explain extended select a from t1 where doc1.double > 5.5; -select a from t1 where doc1.double > 5.5; -explain extended select a from t1 use document keys where doc1.double > 5.5; -select a from t1 use document keys where doc1.double > 5.5; +explain extended select a1 from t1 where doc11.double > 5.5; +select a1 from t1 where doc11.double > 5.5; +explain extended select a1 from t1 use document keys where doc11.double > 5.5; +select a1 from t1 use document keys where doc11.double > 5.5; # group by -explain extended select sum(a) from t1 use document keys group by doc1.double having doc1.double > 5.5; -select sum(a) from t1 use document keys group by doc1.double having doc1.double > 5.5; +explain extended select sum(a1) from t1 use document keys group by doc11.double having doc11.double > 5.5; +select sum(a1) from t1 use document keys group by doc11.double having doc11.double > 5.5; -explain extended select doc1.double from t1 where doc1.double > 5.5; -select doc1.double from t1 where doc1.double > 5.5; -explain extended select doc1.double from t1 use document keys where doc1.double > 5.5; -select doc1.double from t1 use document keys where doc1.double > 5.5; +explain extended select doc11.double from t1 where doc11.double > 5.5; +select doc11.double from t1 where doc11.double > 5.5; +explain extended select doc11.double from t1 use document keys where doc11.double > 5.5; +select doc11.double from t1 use document keys where doc11.double > 5.5; # group by -explain extended select sum(doc1.double) from t1 use document keys group by doc1.double having doc1.double > 5.5; -select sum(doc1.double) from t1 use document keys group by doc1.double having doc1.double > 5.5; +explain extended select sum(doc11.double) from t1 use document keys group by doc11.double having doc11.double > 5.5; +select sum(doc11.double) from t1 use document keys group by doc11.double having doc11.double > 5.5; # on nullable document column -explain extended select a from t1 where doc2.double > 5.5; -select a from t1 where doc2.double > 5.5; -explain extended select a from t1 use document keys where doc2.double > 5.5; -select a from t1 use document keys where doc2.double > 5.5; +explain extended select a1 from t1 where doc12.double > 5.5; +select a1 from t1 where doc12.double > 5.5; +explain extended select a1 from t1 use document keys where doc12.double > 5.5; +select a1 from t1 use document keys where doc12.double > 5.5; # group by -explain extended select count(a) from t1 use document keys group by doc2.double having doc2.double > 5.5; -select count(a) from t1 use document keys group by doc2.double having doc2.double > 5.5; +explain extended select count(a1) from t1 use document keys group by doc12.double having doc12.double > 5.5; +select count(a1) from t1 use document keys group by doc12.double having doc12.double > 5.5; -explain extended select doc2.double from t1 where doc2.double > 5.5; -select doc2.double from t1 where doc2.double > 5.5; -explain extended select doc2.double from t1 use document keys where doc2.double > 5.5; -select doc2.double from t1 use document keys where doc2.double > 5.5; +explain extended select doc12.double from t1 where doc12.double > 5.5; +select doc12.double from t1 where doc12.double > 5.5; +explain extended select doc12.double from t1 use document keys where doc12.double > 5.5; +select doc12.double from t1 use document keys where doc12.double > 5.5; # group by -explain extended select count(doc2.double) from t1 use document keys group by doc2.double having doc2.double > 5.5; -select count(doc2.double) from t1 use document keys group by doc2.double having doc2.double > 5.5; +explain extended select count(doc12.double) from t1 use document keys group by doc12.double having doc12.double > 5.5; +select count(doc12.double) from t1 use document keys group by doc12.double having doc12.double > 5.5; # -# non-covering +# double: covering index for range queries # # on not-nullable document column -explain extended select * from t1 where doc1.double > 5.5; -select * from t1 where doc1.double > 5.5; -explain extended select * from t1 use document keys where doc1.double > 5.5; -select * from t1 use document keys where doc1.double > 5.5; +explain extended select a1 from t1 where doc11.double > 5.5; +select a1 from t1 where doc11.double > 5.5; + +explain extended select a1 from t1 use document keys where doc11.double > 5.5; +select a1 from t1 use document keys where doc11.double > 5.5; + +explain extended select doc11.double from t1 use document keys where doc11.double >= 5.5; +select doc11.double from t1 use document keys where doc11.double >= 5.5; + +# out of range +explain extended select a1 from t1 use document keys where doc11.double > 13.3; +select a1 from t1 use document keys where doc11.double > 13.3; + +explain extended select a1, doc11.double from t1 use document keys where doc11.double < 9.9; +select a1, doc11.double from t1 use document keys where doc11.double < 9.9; + +explain extended select doc11.double, a1 from t1 use document keys where doc11.double <= 9.9; +select doc11.double, a1 from t1 use document keys where doc11.double <= 9.9; + +# out of range +explain extended select doc11.double from t1 use document keys where doc11.double < 0.1; +select doc11.double from t1 use document keys where doc11.double < 0.1; + +explain extended select a1, doc11.double from t1 use document keys where doc11.double > 5.5 and doc11.double < 9.9; +select a1, doc11.double from t1 use document keys where doc11.double > 5.5 and doc11.double < 9.9; + +explain extended select a1 from t1 use document keys where doc11.double >= 5.5 and doc11.double <= 9.9; +select a1 from t1 use document keys where doc11.double >= 5.5 and doc11.double <= 9.9; + +explain extended select a1 from t1 use document keys where doc11.double > 0 and doc11.double < 130; +select a1 from t1 use document keys where doc11.double > 0 and doc11.double < 130; + +# between +explain extended select a1, doc11.double from t1 use document keys where doc11.double between 5.5 and 9.9; +select a1, doc11.double from t1 use document keys where doc11.double between 5.5 and 9.9; + +explain extended select doc11.double from t1 use document keys where doc11.double between 5.5 and 15.5; +select doc11.double from t1 use document keys where doc11.double between 5.5 and 15.5; + +# not between +explain extended select a1, doc11.double from t1 use document keys where doc11.double not between 5.5 and 9.9; +select a1, doc11.double from t1 use document keys where doc11.double not between 5.5 and 9.9; + +explain extended select a1, doc11.double from t1 use document keys where doc11.double not between 5.5 and 130; +select a1, doc11.double from t1 use document keys where doc11.double not between 5.5 and 130; + +# in +explain extended select a1, doc11.double from t1 use document keys where doc11.double in (3.3, 8.8, 4.4); +select a1, doc11.double from t1 use document keys where doc11.double in (3.3, 8.8, 4.4); + +explain extended select a1, doc11.double from t1 use document keys where doc11.double in (5.5, 100, 0); +select a1, doc11.double from t1 use document keys where doc11.double in (5.5, 100, 0); + +# not in +explain extended select a1, doc11.double from t1 use document keys where doc11.double not in (5.5, 7.7, 9.9, 12.12); +select a1, doc11.double from t1 use document keys where doc11.double not in (5.5, 7.7, 9.9, 12.12); + +explain extended select a1, doc11.double from t1 use document keys where doc11.double not in (0, 100, 5.5, 6.6, 7.7, 12.12, 11.11, 10.1); +select a1, doc11.double from t1 use document keys where doc11.double not in (0, 100, 5.5, 6.6, 7.7, 12.12, 11.11, 10.1); + +# multiple ranges without overlap +explain extended select doc11.double from t1 use document keys +where doc11.double > 3.3 and doc11.double < 5.5 or doc11.double > 6.6 and doc11.double < 8.8 or + doc11.double > 9.9 and doc11.double < 11.11 or doc11.double >= 12.12 and doc11.double <= 15.15; + +select doc11.double from t1 use document keys +where doc11.double > 3.3 and doc11.double < 5.5 or doc11.double > 6.6 and doc11.double < 8.8 or + doc11.double > 9.9 and doc11.double < 11.11 or doc11.double >= 12.12 and doc11.double <= 15.15; + +# multiple ranges with overlap +explain extended select doc11.double from t1 use document keys +where doc11.double > 3.3 and doc11.double < 8.8 or doc11.double > 5.5 and doc11.double < 9.9 or + doc11.double > 7.7 and doc11.double <= 15.15 or doc11.double >= 12.12 and doc11.double < 15.15; + +select doc11.double from t1 use document keys +where doc11.double > 3.3 and doc11.double < 8.8 or doc11.double > 5.5 and doc11.double < 9.9 or + doc11.double > 7.7 and doc11.double <= 15.15 or doc11.double >= 12.12 and doc11.double < 15.15; + +explain extended select doc11.double from t1 use document keys +where ((doc11.double > 4.4 and doc11.double < 10.10) and (doc11.double not between 8.8 and 9.9)) or + ((doc11.double between 3.3 and 15.15) and (doc11.double not in (4.4, 5.5))); + +select doc11.double from t1 use document keys +where ((doc11.double > 4.4 and doc11.double < 10.10) and (doc11.double not between 8.8 and 9.9)) or + ((doc11.double between 3.3 and 15.15) and (doc11.double not in (4.4, 5.5))); + +# +# double: non-covering index for range queries +# + +# on not-nullable document column +explain extended select a1, doc11.int from t1 where doc11.double > 5.5; +select a1, doc11.int from t1 where doc11.double > 5.5; + +explain extended select a1, doc11.int from t1 use document keys where doc11.double > 5.5; +select a1, doc11.int from t1 use document keys where doc11.double > 5.5; + +explain extended select doc11.double, doc11.int from t1 use document keys where doc11.double >= 5.5; +select doc11.double, doc11.int from t1 use document keys where doc11.double >= 5.5; + +# out of range +explain extended select a1, doc11.int from t1 use document keys where doc11.double > 13.3; +select a1, doc11.int from t1 use document keys where doc11.double > 13.3; + +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double < 9.9; +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double < 9.9; + +explain extended select doc11.double, a1, doc11.int from t1 use document keys where doc11.double <= 9.9; +select doc11.double, a1, doc11.int from t1 use document keys where doc11.double <= 9.9; + +# out of range +explain extended select doc11.double, doc11.int from t1 use document keys where doc11.double < 0.1; +select doc11.double, doc11.int from t1 use document keys where doc11.double < 0.1; + +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double > 5.5 and doc11.double < 9.9; +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double > 5.5 and doc11.double < 9.9; + +explain extended select a1, doc11.int from t1 use document keys where doc11.double >= 5.5 and doc11.double <= 9.9; +select a1, doc11.int from t1 use document keys where doc11.double >= 5.5 and doc11.double <= 9.9; + +explain extended select a1, doc11.int from t1 use document keys where doc11.double > 0 and doc11.double < 130; +select a1, doc11.int from t1 use document keys where doc11.double > 0 and doc11.double < 130; + +# between +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double between 5.5 and 9.9; +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double between 5.5 and 9.9; + +explain extended select doc11.double, doc11.int from t1 use document keys where doc11.double between 5.5 and 15.5; +select doc11.double, doc11.int from t1 use document keys where doc11.double between 5.5 and 15.5; + +# not between +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not between 5.5 and 9.9; +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not between 5.5 and 9.9; + +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not between 5.5 and 130; +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not between 5.5 and 130; + +# in +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double in (5.5, 7.7, 9.9, 12.12); +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double in (5.5, 7.7, 9.9, 12.12); + +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double in (5.5, 100, 0); +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double in (5.5, 100, 0); + +# not in +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not in (5.5, 7.7, 9.9, 12.12); +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not in (5.5, 7.7, 9.9, 12.12); + +explain extended select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not in (0, 100, 5.5, 6.6, 7.7, 12.12, 11.11, 10.1); +select a1, doc11.double, doc11.int from t1 use document keys where doc11.double not in (0, 100, 5.5, 6.6, 7.7, 12.12, 11.11, 10.1); + +# multiple ranges without overlap +explain extended select doc11.double, doc11.int from t1 use document keys +where doc11.double > 3.3 and doc11.double < 5.5 or doc11.double > 6.6 and doc11.double < 8.8 or + doc11.double > 9.9 and doc11.double < 11.11 or doc11.double >= 12.12 and doc11.double <= 15.15; + +select doc11.double, doc11.int from t1 use document keys +where doc11.double > 3.3 and doc11.double < 5.5 or doc11.double > 6.6 and doc11.double < 8.8 or + doc11.double > 9.9 and doc11.double < 11.11 or doc11.double >= 12.12 and doc11.double <= 15.15; + +# multiple ranges with overlap +explain extended select doc11.double, doc11.int from t1 use document keys +where doc11.double > 3.3 and doc11.double < 8.8 or doc11.double > 5.5 and doc11.double < 9.9 or + doc11.double > 7.7 and doc11.double <= 15.15 or doc11.double >= 12.12 and doc11.double < 15.15; + +select doc11.double, doc11.int from t1 use document keys +where doc11.double > 3.3 and doc11.double < 8.8 or doc11.double > 5.5 and doc11.double < 9.9 or + doc11.double > 7.7 and doc11.double <= 15.15 or doc11.double >= 12.12 and doc11.double < 15.15; + +explain extended select doc11.double, doc11.int from t1 use document keys +where ((doc11.double > 4.4 and doc11.double < 10.10) and (doc11.double not between 8.8 and 9.9)) or + ((doc11.double between 3.3 and 15.15) and (doc11.double not in (4.4, 5.5))); + +select doc11.double, doc11.int from t1 use document keys +where ((doc11.double > 4.4 and doc11.double < 10.10) and (doc11.double not between 8.8 and 9.9)) or + ((doc11.double between 3.3 and 15.15) and (doc11.double not in (4.4, 5.5))); + +# +# double: non-covering index for range queries with aggregations +# + +# on not-nullable document column +explain extended select * from t1 where doc11.double > 5.5; +select * from t1 where doc11.double > 5.5; + +explain extended select * from t1 use document keys where doc11.double > 5.5; +select * from t1 use document keys where doc11.double > 5.5; + # group by -explain extended select count(*) from t1 use document keys group by doc1.double having doc1.double > 5.5; -select count(*) from t1 use document keys group by doc1.double having doc1.double > 5.5; +explain extended select count(*) from t1 use document keys group by doc11.double having doc11.double > 5.5; +select count(*) from t1 use document keys group by doc11.double having doc11.double > 5.5; + +explain extended select doc11 from t1 where doc11.double > 5.5; +select doc11 from t1 where doc11.double > 5.5; + +explain extended select doc11 from t1 use document keys where doc11.double > 5.5; +select doc11 from t1 use document keys where doc11.double > 5.5; -explain extended select doc1 from t1 where doc1.double > 5.5; -select doc1 from t1 where doc1.double > 5.5; -explain extended select doc1 from t1 use document keys where doc1.double > 5.5; -select doc1 from t1 use document keys where doc1.double > 5.5; # group by -explain extended select count(doc1) from t1 use document keys group by doc1.double having doc1.double > 5.5; -select count(doc1) from t1 use document keys group by doc1.double having doc1.double > 5.5; +explain extended select count(doc11) from t1 use document keys group by doc11.double having doc11.double > 5.5; +select count(doc11) from t1 use document keys group by doc11.double having doc11.double > 5.5; + +explain extended select doc11.string from t1 where doc11.double > 5.5; +select doc11.string from t1 where doc11.double > 5.5; + +explain extended select doc11.string from t1 use document keys where doc11.double > 5.5; +select doc11.string from t1 use document keys where doc11.double > 5.5; -explain extended select doc1.string from t1 where doc1.double > 5.5; -select doc1.string from t1 where doc1.double > 5.5; -explain extended select doc1.string from t1 use document keys where doc1.double > 5.5; -select doc1.string from t1 use document keys where doc1.double > 5.5; # group by -explain extended select count(doc1.string) from t1 use document keys group by doc1.double having doc1.double > 5.5; -select count(doc1.string) from t1 use document keys group by doc1.double having doc1.double > 5.5; +explain extended select count(doc11.string) from t1 use document keys group by doc11.double having doc11.double > 5.5; +select count(doc11.string) from t1 use document keys group by doc11.double having doc11.double > 5.5; # on nullable document column -explain extended select * from t1 where doc2.double > 5.5; -select * from t1 where doc2.double > 5.5; -explain extended select * from t1 use document keys where doc2.double > 5.5; -select * from t1 use document keys where doc2.double > 5.5; +explain extended select * from t1 where doc12.double > 5.5; +select * from t1 where doc12.double > 5.5; + +explain extended select * from t1 use document keys where doc12.double > 5.5; +select * from t1 use document keys where doc12.double > 5.5; + # group by -explain extended select count(*) from t1 use document keys group by doc2.double having doc2.double > 5.5; -select count(*) from t1 use document keys group by doc2.double having doc2.double > 5.5; +explain extended select count(*) from t1 use document keys group by doc12.double having doc12.double > 5.5; +select count(*) from t1 use document keys group by doc12.double having doc12.double > 5.5; + +explain extended select doc12 from t1 where doc12.double > 5.5; +select doc12 from t1 where doc12.double > 5.5; + +explain extended select doc12 from t1 use document keys where doc12.double > 5.5; +select doc12 from t1 use document keys where doc12.double > 5.5; -explain extended select doc2 from t1 where doc2.double > 5.5; -select doc2 from t1 where doc2.double > 5.5; -explain extended select doc2 from t1 use document keys where doc2.double > 5.5; -select doc2 from t1 use document keys where doc2.double > 5.5; # group by -explain extended select count(doc2) from t1 use document keys group by doc2.double having doc2.double > 5.5; -select count(doc2) from t1 use document keys group by doc2.double having doc2.double > 5.5; +explain extended select count(doc12) from t1 use document keys group by doc12.double having doc12.double > 5.5; +select count(doc12) from t1 use document keys group by doc12.double having doc12.double > 5.5; + +explain extended select doc12.int from t1 where doc12.double > 5.5; +select doc12.int from t1 where doc12.double > 5.5; + +explain extended select doc12.int from t1 use document keys where doc12.double > 5.5; +select doc12.int from t1 use document keys where doc12.double > 5.5; -explain extended select doc2.int from t1 where doc2.double > 5.5; -select doc2.int from t1 where doc2.double > 5.5; -explain extended select doc2.int from t1 use document keys where doc2.double > 5.5; -select doc2.int from t1 use document keys where doc2.double > 5.5; # group by -explain extended select count(doc2.int) from t1 use document keys group by doc2.double having doc2.double > 5.5; -select count(doc2.int) from t1 use document keys group by doc2.double having doc2.double > 5.5; +explain extended select count(doc12.int) from t1 use document keys group by doc12.double having doc12.double > 5.5; +select count(doc12.int) from t1 use document keys group by doc12.double having doc12.double > 5.5; ## ## string index type ## +--echo FIXME!! Inconsistency between Boolean type and String +--echo Boolean values (true/false) will be converted to "1" /"0" when creating a key image (for range optimization), +--echo but it will be converted to "True"/"False" when getting values from document paths for building index keys. + # -# covering index +# string: covering index # -explain extended select a from t1 where doc1.string = 'eee'; -select a from t1 where doc1.string = 'eee'; -explain extended select a from t1 use document keys where doc1.string = 'eee'; -select a from t1 use document keys where doc1.string = 'eee'; +explain extended select a1 from t1 where doc11.string = 'eee'; +select a1 from t1 where doc11.string = 'eee'; +explain extended select a1 from t1 use document keys where doc11.string = 'eee'; +select a1 from t1 use document keys where doc11.string = 'eee'; # group by string will not be covered by prefix indexes -explain extended select count(a) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -select count(a) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +explain extended select count(a1) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +select count(a1) from t1 use document keys group by doc11.string having doc11.string = 'eee'; -explain extended select doc1.string from t1 where doc1.string = 'eee'; -select doc1.string from t1 where doc1.string = 'eee'; -explain extended select doc1.string from t1 use document keys where doc1.string = 'eee'; -select doc1.string from t1 use document keys where doc1.string = 'eee'; +explain extended select doc11.string from t1 where doc11.string = 'eee'; +select doc11.string from t1 where doc11.string = 'eee'; +explain extended select doc11.string from t1 use document keys where doc11.string = 'eee'; +select doc11.string from t1 use document keys where doc11.string = 'eee'; # group by string will not be covered by prefix indexes -explain extended select count(doc1.string) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -select count(doc1.string) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +explain extended select count(doc11.string) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +select count(doc11.string) from t1 use document keys group by doc11.string having doc11.string = 'eee'; # -# non-covering +# string: non-covering # -explain extended select * from t1 where doc1.string = 'eee'; -select * from t1 where doc1.string = 'eee'; -explain extended select * from t1 use document keys where doc1.string = 'eee'; -select * from t1 use document keys where doc1.string = 'eee'; +explain extended select * from t1 where doc11.string = 'eee'; +select * from t1 where doc11.string = 'eee'; +explain extended select * from t1 use document keys where doc11.string = 'eee'; +select * from t1 use document keys where doc11.string = 'eee'; # group by -explain extended select count(*) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -select count(*) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +explain extended select count(*) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +select count(*) from t1 use document keys group by doc11.string having doc11.string = 'eee'; -explain extended select doc1 from t1 where doc1.string = 'eee'; -select doc1 from t1 where doc1.string = 'eee'; -explain extended select doc1 from t1 use document keys where doc1.string = 'eee'; -select doc1 from t1 use document keys where doc1.string = 'eee'; +explain extended select doc11 from t1 where doc11.string = 'eee'; +select doc11 from t1 where doc11.string = 'eee'; +explain extended select doc11 from t1 use document keys where doc11.string = 'eee'; +select doc11 from t1 use document keys where doc11.string = 'eee'; # group by -explain extended select count(doc1) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -select count(doc1) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +explain extended select count(doc11) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +select count(doc11) from t1 use document keys group by doc11.string having doc11.string = 'eee'; -explain extended select doc1.int from t1 where doc1.string = 'eee'; -select doc1.int from t1 where doc1.string = 'eee'; -explain extended select doc1.int from t1 use document keys where doc1.string = 'eee'; -select doc1.int from t1 use document keys where doc1.string = 'eee'; +explain extended select doc11.int from t1 where doc11.string = 'eee'; +select doc11.int from t1 where doc11.string = 'eee'; +explain extended select doc11.int from t1 use document keys where doc11.string = 'eee'; +select doc11.int from t1 use document keys where doc11.string = 'eee'; # group by -explain extended select sum(doc1.int) from t1 use document keys group by doc1.string having doc1.string = 'eee'; -select sum(doc1.int) from t1 use document keys group by doc1.string having doc1.string = 'eee'; +explain extended select sum(doc11.int) from t1 use document keys group by doc11.string having doc11.string = 'eee'; +select sum(doc11.int) from t1 use document keys group by doc11.string having doc11.string = 'eee'; # -# TODO: pattern matching is not supported on prefix index scan +# string: pattern match for string index key # -explain extended select a from t1 where doc1.string like 'e%'; -select a from t1 where doc1.string like 'e%'; -explain extended select a from t1 use document keys where doc1.string like 'e%'; -select a from t1 use document keys where doc1.string like 'e%'; +explain extended select a1 from t1 where doc11.string like 'e%'; +select a1 from t1 where doc11.string like 'e%'; +explain extended select a1 from t1 use document keys where doc11.string like 'e%'; +select a1 from t1 use document keys where doc11.string like 'e%'; + +explain extended select doc11.string from t1 where doc11.string like 'e%'; +select doc11.string from t1 where doc11.string like 'e%'; +explain extended select doc11.string from t1 use document keys where doc11.string like 'e%'; +select doc11.string from t1 use document keys where doc11.string like 'e%'; + +explain extended select * from t1 where doc11.string like 'e%'; +select * from t1 where doc11.string like 'e%'; +explain extended select * from t1 use document keys where doc11.string like 'e%'; +select * from t1 use document keys where doc11.string like 'e%'; + +explain extended select doc11 from t1 where doc11.string like 'e%'; +select doc11 from t1 where doc11.string like 'e%'; +explain extended select doc11 from t1 use document keys where doc11.string like 'e%'; +select doc11 from t1 use document keys where doc11.string like 'e%'; + +explain extended select doc11.int from t1 where doc11.string like 'e%'; +select doc11.int from t1 where doc11.string like 'e%'; +explain extended select doc11.int from t1 use document keys where doc11.string like 'e%'; +select doc11.int from t1 use document keys where doc11.string like 'e%'; + +# +# string: covering index for range queries +# + +# on not-nullable document column +explain extended select a1 from t1 where doc11.string > 'ee'; +select a1 from t1 where doc11.string > 'ee'; + +explain extended select a1 from t1 use document keys where doc11.string > 'eee'; +select a1 from t1 use document keys where doc11.string > 'eee'; + +explain extended select doc11.string from t1 use document keys where doc11.string >= 'kkk'; +select doc11.string from t1 use document keys where doc11.string >= 'kkk'; + +# out of range +explain extended select a1 from t1 use document keys where doc11.string > 'zzz'; +select a1 from t1 use document keys where doc11.string > 'zzz'; + +explain extended select a1, doc11.string from t1 use document keys where doc11.string < 'iii'; +select a1, doc11.string from t1 use document keys where doc11.string < 'iii'; + +explain extended select doc11.string, a1 from t1 use document keys where doc11.string <= 'iii'; +select doc11.string, a1 from t1 use document keys where doc11.string <= 'iii'; + +# out of range +explain extended select doc11.string from t1 use document keys where doc11.string < 'aaa'; +select doc11.double from t1 use document keys where doc11.string < 'aaa'; + +explain extended select a1, doc11.string from t1 use document keys where doc11.string > 'eee' and doc11.string < 'iii'; +select a1, doc11.string from t1 use document keys where doc11.string > 'eee' and doc11.string < 'iii'; + +explain extended select a1 from t1 use document keys where doc11.string >= 'eee' and doc11.string <= 'iii'; +select a1 from t1 use document keys where doc11.string >= 'eee' and doc11.string <= 'iii'; + +explain extended select a1 from t1 use document keys where doc11.string > '' and doc11.string < 'zzz'; +select a1 from t1 use document keys where doc11.string > '' and doc11.string < 'zzz'; + +# between +explain extended select a1, doc11.string from t1 use document keys where doc11.string between 'eee' and 'iii'; +select a1, doc11.string from t1 use document keys where doc11.string between 'eee' and 'iii'; + +explain extended select doc11.string from t1 use document keys where doc11.string between 'eee' and 'zzz'; +select doc11.string from t1 use document keys where doc11.string between 'eee' and 'zzz'; + +# not between +explain extended select a1, doc11.string from t1 use document keys where doc11.string not between 'eee' and 'iii'; +select a1, doc11.string from t1 use document keys where doc11.string not between 'eee' and 'iii'; + +explain extended select a1, doc11.string from t1 use document keys where doc11.string not between 'eee' and 'zzz'; +select a1, doc11.string from t1 use document keys where doc11.string not between 'eee' and 'zzz'; + +# in +explain extended select a1, doc11.string from t1 use document keys where doc11.string in ('eee', 'ggg', 'iii', 'lll'); +select a1, doc11.string from t1 use document keys where doc11.string in ('eee', 'ggg', 'iii', 'lll'); + +explain extended select a1, doc11.string from t1 use document keys where doc11.string in ('eee', 'zzz', ''); +select a1, doc11.string from t1 use document keys where doc11.string in ('eee', 'zzz', ''); + +# not in +explain extended select a1, doc11.string from t1 use document keys where doc11.string not in ('eee', 'ggg', 'iii', 'lll'); +select a1, doc11.string from t1 use document keys where doc11.string not in ('eee', 'ggg', 'iii', 'lll'); + +explain extended select a1, doc11.string from t1 use document keys where doc11.string not in ('', 'zzz', 'eee', 'fff', 'ggg', 'lll', 'iii', 'hhh'); +select a1, doc11.string from t1 use document keys where doc11.string not in ('', 'zzz', 'eee', 'fff', 'ggg', 'lll', 'iii', 'hhh'); + +# multiple ranges without overlap +explain extended select doc11.string from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'fff' or doc11.string > 'ggg' and doc11.string < 'hhh' or + doc11.string > 'iii' and doc11.string < 'kkk' or doc11.string >= 'lll' and doc11.string <= 'zzz'; + +select doc11.string from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'fff' or doc11.string > 'ggg' and doc11.string < 'hhh' or + doc11.string > 'iii' and doc11.string < 'kkk' or doc11.string >= 'lll' and doc11.string <= 'zzz'; + +# multiple ranges with overlap +explain extended select doc11.string from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'hhh' or doc11.string > 'fff' and doc11.string < 'iii' or + doc11.string > 'ggg' and doc11.string <= 'zzz' or doc11.string >= 'lll' and doc11.string < 'zzz'; + +select doc11.string from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'hhh' or doc11.string > 'fff' and doc11.string < 'iii' or + doc11.string > 'ggg' and doc11.string <= 'zzz' or doc11.string >= 'lll' and doc11.string < 'zzz'; + +explain extended select doc11.string from t1 use document keys +where ((doc11.string > 'ccc' and doc11.string < 'hhh') and (doc11.string not between 'ggg' and 'iii')) or + ((doc11.string between 'kkk' and 'zzz') and (doc11.string not in ('ddd', 'eee'))); + +select doc11.string from t1 use document keys +where ((doc11.string > 'ccc' and doc11.string < 'hhh') and (doc11.string not between 'ggg' and 'iii')) or + ((doc11.string between 'kkk' and 'zzz') and (doc11.string not in ('ddd', 'eee'))); + +# +# string: non-covering index for range queries +# + +# on not-nullable document column +explain extended select a1, doc11.int from t1 where doc11.string > 'eee'; +select a1, doc11.int from t1 where doc11.string > 'eee'; + +explain extended select a1, doc11.int from t1 use document keys where doc11.string > 'eee'; +select a1, doc11.int from t1 use document keys where doc11.string > 'eee'; + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.string >= 'kkk'; +select doc11.string, doc11.int from t1 use document keys where doc11.string >= 'kkk'; + +# out of range +explain extended select a1, doc11.int from t1 use document keys where doc11.string > 'zzz'; +select a1, doc11.int from t1 use document keys where doc11.string > 'zzz'; + +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string < 'iii'; +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string < 'iii'; + +explain extended select doc11.string, a1, doc11.int from t1 use document keys where doc11.string <= 'iii'; +select doc11.string, a1, doc11.int from t1 use document keys where doc11.string <= 'iii'; + +# out of range +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.string < 'aaa'; +select doc11.string, doc11.int from t1 use document keys where doc11.string < 'aaa'; + +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string > 'eee' and doc11.string < 'iii'; +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string > 'eee' and doc11.string < 'iii'; + +explain extended select a1, doc11.int from t1 use document keys where doc11.string >= 'eee' and doc11.string <= 'iii'; +select a1, doc11.int from t1 use document keys where doc11.string >= 'eee' and doc11.string <= 'iii'; + +explain extended select a1, doc11.int from t1 use document keys where doc11.string > '' and doc11.string < 'zzz'; +select a1, doc11.int from t1 use document keys where doc11.string > '' and doc11.string < 'zzz'; + +# between +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string between 'eee' and 'iii'; +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string between 'eee' and 'iii'; + +explain extended select doc11.string, doc11.int from t1 use document keys where doc11.string between 'eee' and 'zzz'; +select doc11.string, doc11.int from t1 use document keys where doc11.string between 'eee' and 'zzz'; + +# not between +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not between 'eee' and 'iii'; +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not between 'eee' and 'iii'; + +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not between 'eee' and 'zzz'; +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not between 'eee' and 'zzz'; -explain extended select doc1.string from t1 where doc1.string like 'e%'; -select doc1.string from t1 where doc1.string like 'e%'; -explain extended select doc1.string from t1 use document keys where doc1.string like 'e%'; -select doc1.string from t1 use document keys where doc1.string like 'e%'; +# in +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string in ('eee', 'ggg', 'iii', 'lll'); +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string in ('eee', 'ggg', 'iii', 'lll'); -explain extended select * from t1 where doc1.string like 'e%'; -select * from t1 where doc1.string like 'e%'; -explain extended select * from t1 use document keys where doc1.string like 'e%'; -select * from t1 use document keys where doc1.string like 'e%'; +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string in ('eee', 'zzz', ''); +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string in ('eee', 'zzz', ''); -explain extended select doc1 from t1 where doc1.string like 'e%'; -select doc1 from t1 where doc1.string like 'e%'; -explain extended select doc1 from t1 use document keys where doc1.string like 'e%'; -select doc1 from t1 use document keys where doc1.string like 'e%'; +# not in +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not in ('eee', 'ggg', 'iii', 'lll'); +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not in ('eee', 'ggg', 'iii', 'lll'); -explain extended select doc1.int from t1 where doc1.string like 'e%'; -select doc1.int from t1 where doc1.string like 'e%'; -explain extended select doc1.int from t1 use document keys where doc1.string like 'e%'; -select doc1.int from t1 use document keys where doc1.string like 'e%'; +explain extended select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not in ('', 'zzz', 'eee', 'fff', 'ggg', 'lll', 'iii', 'hhh'); +select a1, doc11.string, doc11.int from t1 use document keys where doc11.string not in ('', 'zzz', 'eee', 'fff', 'ggg', 'lll', 'iii', 'hhh'); +# multiple ranges without overlap +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'fff' or doc11.string > 'ggg' and doc11.string < 'hhh' or + doc11.string > 'iii' and doc11.string < 'kkk' or doc11.string >= 'lll' and doc11.string <= 'zzz'; + +select doc11.string, doc11.int from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'fff' or doc11.string > 'ggg' and doc11.string < 'hhh' or + doc11.string > 'iii' and doc11.string < 'kkk' or doc11.string >= 'lll' and doc11.string <= 'zzz'; + +# multiple ranges with overlap +explain extended select doc11.string, doc11.int from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'hhh' or doc11.string > 'fff' and doc11.string < 'iii' or + doc11.string > 'ggg' and doc11.string <= 'zzz' or doc11.string >= 'lll' and doc11.string < 'zzz'; + +select doc11.string, doc11.int from t1 use document keys +where doc11.string > 'ccc' and doc11.string < 'hhh' or doc11.string > 'fff' and doc11.string < 'iii' or + doc11.string > 'ggg' and doc11.string <= 'zzz' or doc11.string >= 'lll' and doc11.string < 'zzz'; + +explain extended select doc11.string, doc11.int from t1 use document keys +where ((doc11.string > 'ccc' and doc11.string < 'hhh') and (doc11.string not between 'ggg' and 'iii')) or + ((doc11.string between 'kkk' and 'zzz') and (doc11.string not in ('ddd', 'eee'))); + +select doc11.string, doc11.int from t1 use document keys +where ((doc11.string > 'ccc' and doc11.string < 'hhh') and (doc11.string not between 'ggg' and 'iii')) or + ((doc11.string between 'kkk' and 'zzz') and (doc11.string not in ('ddd', 'eee'))); ## ## composite index @@ -447,191 +1262,607 @@ select doc1.int from t1 use document keys where doc1.string like 'e%'; # # doc1_b and b_doc1 -explain extended select doc1.int from t1 where b = 5; -select doc1.int from t1 where b = 5; -explain extended select doc1.int from t1 use document keys where b = 5; -select doc1.int from t1 use document keys where b = 5; - -explain extended select b from t1 where doc1.int = 5; -select b from t1 where doc1.int = 5; -explain extended select b from t1 use document keys where doc1.int = 5; -select b from t1 use document keys where doc1.int = 5; +explain extended select doc11.int from t1 where b1 = 5; +select doc11.int from t1 where b1 = 5; +explain extended select doc11.int from t1 use document keys where b1 = 5; +select doc11.int from t1 use document keys where b1 = 5; + +explain extended select b1 from t1 where doc11.int = 5; +select b1 from t1 where doc11.int = 5; +explain extended select b1 from t1 use document keys where doc11.int = 5; +select b1 from t1 use document keys where doc11.int = 5; # group by -explain extended select count(b) from t1 use document keys group by doc1.int having doc1.int = 5; -select count(b) from t1 use document keys group by doc1.int having doc1.int = 5; +explain extended select count(b1) from t1 use document keys group by doc11.int having doc11.int = 5; +select count(b1) from t1 use document keys group by doc11.int having doc11.int = 5; -explain extended select b from t1 where doc1.int > 5; -select b from t1 where doc1.int > 5; -explain extended select d from t1 use document keys where doc1.int > 5; -select b from t1 use document keys where doc1.int > 5; +explain extended select b1 from t1 where doc11.int > 5; +select b1 from t1 where doc11.int > 5; +explain extended select d1 from t1 use document keys where doc11.int > 5; +select b1 from t1 use document keys where doc11.int > 5; # group by -explain extended select sum(b) from t1 use document keys group by doc1.int having doc1.int > 5; -select sum(b) from t1 use document keys group by doc1.int having doc1.int > 5; +explain extended select sum(b1) from t1 use document keys group by doc11.int having doc11.int > 5; +select sum(b1) from t1 use document keys group by doc11.int having doc11.int > 5; # doc1_c -explain extended select doc1.double from t1 where c = 5.5; -select doc1.double from t1 where c = 5.5; -explain extended select doc1.double from t1 use document keys where c = 5.5; -select doc1.double from t1 use document keys where c = 5.5; +explain extended select doc11.double from t1 where c1 = 5.5; +select doc11.double from t1 where c1 = 5.5; +explain extended select doc11.double from t1 use document keys where c1 = 5.5; +select doc11.double from t1 use document keys where c1 = 5.5; -explain extended select c from t1 where doc1.double = 5.5; -select c from t1 where doc1.double = 5.5; +explain extended select c1 from t1 where doc11.double = 5.5; +select c1 from t1 where doc11.double = 5.5; -explain extended select c from t1 use document keys where doc1.double = 5.5; -select c from t1 use document keys where doc1.double = 5.5; +explain extended select c1 from t1 use document keys where doc11.double = 5.5; +select c1 from t1 use document keys where doc11.double = 5.5; # work-around -explain extended select c from t1 use document keys where doc1.double = '5.5'; -select c from t1 use document keys where doc1.double = '5.5'; +explain extended select c1 from t1 use document keys where doc11.double = '5.5'; +select c1 from t1 use document keys where doc11.double = '5.5'; -explain extended select c from t1 where doc1.double > 5.5; -select c from t1 where doc1.double > 5.5; -explain extended select c from t1 use document keys where doc1.double > 5.5; -select c from t1 use document keys where doc1.double > 5.5; +explain extended select c1 from t1 where doc11.double > 5.5; +select c1 from t1 where doc11.double > 5.5; +explain extended select c1 from t1 use document keys where doc11.double > 5.5; +select c1 from t1 use document keys where doc11.double > 5.5; # doc1_d -explain extended select doc1.int from t1 where d = 'eee'; -select doc1.int from t1 where d = 'eee'; -explain extended select doc1.int from t1 use document keys where d = 'eee'; -select doc1.int from t1 use document keys where d = 'eee'; - -explain extended select d from t1 where doc1.int = 5; -select d from t1 where doc1.int = 5; -explain extended select d from t1 use document keys where doc1.int = 5; -select d from t1 use document keys where doc1.int = 5; - -explain extended select d from t1 where doc1.int > 5; -select d from t1 where doc1.int > 5; -explain extended select d from t1 use document keys where doc1.int > 5; -select d from t1 use document keys where doc1.int > 5; - -explain extended select d from t1 where doc1.int = '5'; -select d from t1 where doc1.int = '5'; -explain extended select d from t1 use document keys where doc1.int = '5'; -select d from t1 use document keys where doc1.int = '5'; - -explain extended select d from t1 where doc1.int < '5'; -select d from t1 where doc1.int < '5'; -explain extended select d from t1 use document keys where doc1.int < '5'; -select d from t1 use document keys where doc1.int < '5'; - -explain extended select a from t1 where doc1.int = 5; -select a from t1 where doc1.int = 5; -explain extended select a from t1 use document keys where doc1.int = 5; -select a from t1 use document keys where doc1.int = 5; - -explain extended select a from t1 where doc1.int >= 5; -select a from t1 where doc1.int >= 5; -explain extended select a from t1 use document keys where doc1.int >= 5; -select a from t1 use document keys where doc1.int >= 5; - -explain extended select a from t1 where d like 'eee' and doc1.int = 5; -select a from t1 where d like 'eee' and doc1.int = 5; -explain extended select a from t1 use document keys where d like 'eee' and doc1.int = 5; -select a from t1 use document keys where d like 'eee' and doc1.int = 5; - -explain extended select a from t1 where d like 'e%' and doc1.int > 4; -select a from t1 where d like 'e%' and doc1.int > 4; -explain extended select a from t1 use document keys where d like 'e%' and doc1.int > 4; -select a from t1 use document keys where d like 'e%' and doc1.int > 4; - -explain extended select a, d, doc1.int from t1 where d like 'eee' and doc1.int = 5; -select a, d, doc1.int from t1 where d like 'eee' and doc1.int = 5; -explain extended select a, d, doc1.int from t1 use document keys where d like 'eee' and doc1.int = 5; -select a, d, doc1.int from t1 use document keys where d like 'eee' and doc1.int = 5; - -explain extended select a, d, doc1.int from t1 where d like 'e%' and doc1.int < 6; -select a, d, doc1.int from t1 where d like 'e%' and doc1.int < 6; -explain extended select a, d, doc1.int from t1 use document keys where d like 'e%' and doc1.int < 6; -select a, d, doc1.int from t1 use document keys where d like 'e%' and doc1.int < 6; +explain extended select doc11.int from t1 where d1 = 'eee'; +select doc11.int from t1 where d1 = 'eee'; +explain extended select doc11.int from t1 use document keys where d1 = 'eee'; +select doc11.int from t1 use document keys where d1 = 'eee'; + +explain extended select d1 from t1 where doc11.int = 5; +select d1 from t1 where doc11.int = 5; +explain extended select d1 from t1 use document keys where doc11.int = 5; +select d1 from t1 use document keys where doc11.int = 5; + +explain extended select d1 from t1 where doc11.int > 5; +select d1 from t1 where doc11.int > 5; +explain extended select d1 from t1 use document keys where doc11.int > 5; +select d1 from t1 use document keys where doc11.int > 5; + +explain extended select d1 from t1 where doc11.int = '5'; +select d1 from t1 where doc11.int = '5'; +explain extended select d1 from t1 use document keys where doc11.int = '5'; +select d1 from t1 use document keys where doc11.int = '5'; + +explain extended select d1 from t1 where doc11.int < '5'; +select d1 from t1 where doc11.int < '5'; +explain extended select d1 from t1 use document keys where doc11.int < '5'; +select d1 from t1 use document keys where doc11.int < '5'; + +explain extended select a1 from t1 where doc11.int = 5; +select a1 from t1 where doc11.int = 5; +explain extended select a1 from t1 use document keys where doc11.int = 5; +select a1 from t1 use document keys where doc11.int = 5; + +explain extended select a1 from t1 where doc11.int >= 5; +select a1 from t1 where doc11.int >= 5; +explain extended select a1 from t1 use document keys where doc11.int >= 5; +select a1 from t1 use document keys where doc11.int >= 5; + +explain extended select a1 from t1 where d1 like 'eee' and doc11.int = 5; +select a1 from t1 where d1 like 'eee' and doc11.int = 5; +explain extended select a1 from t1 use document keys where d1 like 'eee' and doc11.int = 5; +select a1 from t1 use document keys where d1 like 'eee' and doc11.int = 5; + +explain extended select a1 from t1 where d1 like 'e%' and doc11.int > 4; +select a1 from t1 where d1 like 'e%' and doc11.int > 4; +explain extended select a1 from t1 use document keys where d1 like 'e%' and doc11.int > 4; +select a1 from t1 use document keys where d1 like 'e%' and doc11.int > 4; + +explain extended select a1, d1, doc11.int from t1 where d1 like 'eee' and doc11.int = 5; +select a1, d1, doc11.int from t1 where d1 like 'eee' and doc11.int = 5; +explain extended select a1, d1, doc11.int from t1 use document keys where d1 like 'eee' and doc11.int = 5; +select a1, d1, doc11.int from t1 use document keys where d1 like 'eee' and doc11.int = 5; + +explain extended select a1, d1, doc11.int from t1 where d1 like 'e%' and doc11.int < 6; +select a1, d1, doc11.int from t1 where d1 like 'e%' and doc11.int < 6; +explain extended select a1, d1, doc11.int from t1 use document keys where d1 like 'e%' and doc11.int < 6; +select a1, d1, doc11.int from t1 use document keys where d1 like 'e%' and doc11.int < 6; # # index access but no covering index # -explain extended select b from t1 where doc1.int = 5; -select b from t1 where doc1.int = 5; -explain extended select b from t1 use document keys where doc1.int = 5; -select b from t1 use document keys where doc1.int = 5; - -explain extended select * from t1 where doc1.int = 5; -select * from t1 where doc1.int = 5; -explain extended select * from t1 use document keys where doc1.int = 5; -select * from t1 use document keys where doc1.int = 5; +explain extended select b1 from t1 where doc11.int = 5; +select b1 from t1 where doc11.int = 5; +explain extended select b1 from t1 use document keys where doc11.int = 5; +select b1 from t1 use document keys where doc11.int = 5; -explain extended select doc1.double from t1 where doc1.int = 5; -select doc1.double from t1 where doc1.int = 5; +explain extended select * from t1 where doc11.int = 5; +select * from t1 where doc11.int = 5; +explain extended select * from t1 use document keys where doc11.int = 5; +select * from t1 use document keys where doc11.int = 5; -explain extended select doc1.double from t1 use document keys where doc1.int = 5; -select doc1.double from t1 use document keys where doc1.int = 5; +explain extended select doc11.double from t1 where doc11.int = 5; +select doc11.double from t1 where doc11.int = 5; -explain extended select doc1 from t1 where doc1.int = 5; -select doc1 from t1 where doc1.int = 5; +explain extended select doc11.double from t1 use document keys where doc11.int = 5; +select doc11.double from t1 use document keys where doc11.int = 5; -explain extended select doc1 from t1 use document keys where doc1.int = 5; -select doc1 from t1 use document keys where doc1.int = 5; +explain extended select doc11 from t1 where doc11.int = 5; +select doc11 from t1 where doc11.int = 5; -# range query works fine if select list is a different document path -explain extended select doc1.double from t1 where doc1.int < 5; -select doc1.double from t1 where doc1.int < 5; -explain extended select doc1.double from t1 use document keys where doc1.int < 5; -select doc1.double from t1 use document keys where doc1.int < 5; - -# range query works fine if select list is a document column -explain extended select doc1 from t1 where doc1.int > 5; -select doc1 from t1 where doc1.int > 5; -explain extended select doc1 from t1 use document keys where doc1.int > 5; -select doc1 from t1 use document keys where doc1.int > 5; +explain extended select doc11 from t1 use document keys where doc11.int = 5; +select doc11 from t1 use document keys where doc11.int = 5; # if the select list is not covered by index, query works fine as well -explain extended select b, doc1.double from t1 where doc1.int = 5; -select b, doc1.double from t1 where doc1.int = 5; -explain extended select b, doc1.double from t1 use document keys where doc1.int = 5; -select b, doc1.double from t1 use document keys where doc1.int = 5; +explain extended select b1, doc11.double from t1 where doc11.int = 5; +select b1, doc11.double from t1 where doc11.int = 5; +explain extended select b1, doc11.double from t1 use document keys where doc11.int = 5; +select b1, doc11.double from t1 use document keys where doc11.int = 5; -explain extended select b, doc1 from t1 where doc1.int = 5; -select b, doc1 from t1 where doc1.int = 5; -explain extended select b, doc1 from t1 use document keys where doc1.int = 5; -select b, doc1 from t1 use document keys where doc1.int = 5; +explain extended select b1, doc11 from t1 where doc11.int = 5; +select b1, doc11 from t1 where doc11.int = 5; +explain extended select b1, doc11 from t1 use document keys where doc11.int = 5; +select b1, doc11 from t1 use document keys where doc11.int = 5; # # not all conditions are covered by index # -explain extended select b from t1 where doc1.int = 5 and d = 5.5; -select b from t1 where doc1.int = 5 and d = 5.5; -explain extended select b from t1 use document keys where doc1.int = 5 and d = 5.5; -select b from t1 use document keys where doc1.int = 5 and d = 5.5; +explain extended select b1 from t1 where doc11.int = 5 and d1 = 5.5; +select b1 from t1 where doc11.int = 5 and d1 = 5.5; +explain extended select b1 from t1 use document keys where doc11.int = 5 and d1 = 5.5; +select b1 from t1 use document keys where doc11.int = 5 and d1 = 5.5; -explain extended select b from t1 where doc1.int = 5 and d > 5; -select b from t1 where doc1.int = 5 and d > 5; -explain extended select b from t1 use document keys where doc1.int = 5 and d > 5; -select b from t1 use document keys where doc1.int = 5 and d > 5; +explain extended select b1 from t1 where doc11.int = 5 and d1 > 5; +select b1 from t1 where doc11.int = 5 and d1 > 5; +explain extended select b1 from t1 use document keys where doc11.int = 5 and d1 > 5; +select b1 from t1 use document keys where doc11.int = 5 and d1 > 5; # # doc1 key is considered but the smaller b_a key is picked # -explain extended select c from t1 where doc1.int = 5 and b = 5; -select c from t1 where doc1.int = 5 and b = 5; -explain extended select c from t1 use document keys where doc1.int = 5 and b = 5; -select c from t1 use document keys where doc1.int = 5 and b = 5; +explain extended select c1 from t1 where doc11.int = 5 and b1 = 5; +select c1 from t1 where doc11.int = 5 and b1 = 5; +explain extended select c1 from t1 use document keys where doc11.int = 5 and b1 = 5; +select c1 from t1 use document keys where doc11.int = 5 and b1 = 5; # # full table scan: where-condition is not part of any indexes # -explain extended select doc1.int from t1 where doc1.id = 5; -select doc1.int from t1 where doc1.id = 5; -explain extended select doc1.int from t1 use document keys where doc1.id = 5; -select doc1.int from t1 use document keys where doc1.id = 5; +explain extended select doc11.int from t1 where doc11.id = 5; +select doc11.int from t1 where doc11.id = 5; +explain extended select doc11.int from t1 use document keys where doc11.id = 5; +select doc11.int from t1 use document keys where doc11.id = 5; -explain extended select a, b from t1 where doc1.id = 5; -select a, b from t1 where doc1.id = 5; -explain extended select a, b from t1 use document keys where doc1.id = 5; -select a, b from t1 use document keys where doc1.id = 5; +explain extended select a1, b1 from t1 where doc11.id = 5; +select a1, b1 from t1 where doc11.id = 5; +explain extended select a1, b1 from t1 use document keys where doc11.id = 5; +select a1, b1 from t1 use document keys where doc11.id = 5; # to check whether value of document path in the temporal table can be read correct when using index -select a, doc1.int from t1 use document keys order by doc1.int; +select a1, doc11.int from t1 use document keys order by doc11.int; + + +################################################################################ +### +### Multi-table equi-joins and range joins +### + +## +## convering index for two table equi-join +## + +# int +explain extended select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.int = t2.doc21.int; + +select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.int = t2.doc21.int; + +# bool +explain extended select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where t1.doc11.bool = t2.doc21.bool and t1.doc11.int < 3; + +# double +explain extended select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double = t2.doc21.double; + +--echo NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double = t2.doc21.double; + +# string +explain extended select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.string = t2.doc21.string; + +select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.string = t2.doc21.string; + +## +## non-convering index for two table equi-join +## + +# int +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.int = t2.doc21.int; + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.int = t2.doc21.int; + +# bool +explain extended select t1.doc11.bool, t1.doc11.string, t2.doc21.bool, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.bool = t2.doc21.bool and t1.doc11.bool is false; + +# double +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double = t2.doc21.double; + +--echo NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double = t2.doc21.double; + +# string +explain extended select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.string = t2.doc21.string; + +select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.string = t2.doc21.string; + +## +## covering index for two table range join +## + +# int +explain extended select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > 10; + +select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > 10; + +explain extended select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; + +select t1.doc11.int, t2.doc21.int +from t1 use document keys, t2 use document keys +where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; + +# bool +explain extended select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > 0; + +select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > 0; + +explain extended select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where (t1.doc11.bool between 1 and 2) and (t2.doc21.bool between 7 and 9) and t1.doc11.bool > t2.doc21.bool; + +select t1.doc11.bool, t2.doc21.bool +from t1 use document keys, t2 use document keys +where (t1.doc11.bool between 1 and 2) and (t2.doc21.bool between 7 and 9) and t1.doc11.bool > t2.doc21.bool; + +# double +explain extended select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double; + +--echo NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double; + +explain extended select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > 1.1; + +select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > 1.1; + +explain extended select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where (t1.doc11.double between 1.1 and 9.9) and (t2.doc21.double between 2.2 and 11.11) and t1.doc11.double >= t2.doc21.double; + +select t1.doc11.double, t2.doc21.double +from t1 use document keys, t2 use document keys +where (t1.doc11.double between 1.1 and 9.9) and (t2.doc21.double between 2.2 and 11.11) and t1.doc11.double >= t2.doc21.double; + +# string +explain extended select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > 'ggg'; + +select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > 'ggg'; + +explain extended select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.string between 'bbb' and 'iii') and (t2.doc21.string between 'aa' and 'kkk') and t1.doc11.string >= t2.doc21.string; + +select t1.doc11.string, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.string between 'bbb' and 'iii') and (t2.doc21.string between 'aa' and 'kkk') and t1.doc11.string >= t2.doc21.string; + +## +## non-covering index for two table range join +## + +# int +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > 10; + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > 10; + +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.int between 3 and 8) and (t2.doc21.int between 7 and 9) and t1.doc11.int > t2.doc21.int; + +# bool +explain extended select t1.doc11.bool, t1.doc11.string, t2.doc21.bool, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > 0; + +explain extended select t1.doc11.bool, t1.doc11.string, t2.doc21.bool, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.bool between 0 and 1) and (t2.doc21.bool between 1 and 2) and t1.doc11.bool >= t2.doc21.bool; + +# double +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double; + +--echo NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double; + +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > 1.1; + +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > 1.1; + +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.double between 2.2 and 12.12) and (t2.doc21.double between 1.1 and 9.9) and t1.doc11.double >= t2.doc21.double; + +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string +from t1 use document keys, t2 use document keys +where (t1.doc11.double between 2.2 and 12.12) and (t2.doc21.double between 1.1 and 9.9) and t1.doc11.double >= t2.doc21.double; + +# string +explain extended select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > 'ggg'; + +select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > 'ggg'; + +explain extended select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where (t1.doc11.string between 'bb' and 'ggg') and (t2.doc21.string between 'aaa' and 'kkk') and (t1.doc11.string >= t2.doc21.string); + +select t1.doc11.string, t1.doc11.int, t2.doc21.string, t2.doc21.int +from t1 use document keys, t2 use document keys +where (t1.doc11.string between 'bb' and 'ggg') and (t2.doc21.string between 'aaa' and 'kkk') and (t1.doc11.string >= t2.doc21.string); + +## +## covering index for three table equi-join +## + +explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; + +select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; + +## +## non-covering index for three table equi-join +## + +# int +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int = t2.doc21.int and t1.doc11.int = t3.doc31.int; + +# bool +explain extended select t1.doc11.bool, t1.doc11.string, t2.doc21.bool, t2.doc21.string, t3.doc31.bool, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.bool = t2.doc21.bool and t1.doc11.bool = t3.doc31.bool; + +# double +explain extended select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string, t3.doc31.double, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double = t2.doc21.double and t1.doc11.double = t3.doc31.double; + +select t1.doc11.double, t1.doc11.string, t2.doc21.double, t2.doc21.string, t3.doc31.double, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double = t2.doc21.double and t1.doc11.double = t3.doc31.double; + +# string +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string = t2.doc21.string and t1.doc11.string = t3.doc31.string; + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string = t2.doc21.string and t1.doc11.string = t3.doc31.string; + + +## +## covering index for three table range join +## + +# int +explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; + +select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; + +explain extended select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.int between 1 and 12) and (t2.doc21.int between 2 and 10) and (t3.doc31.int between 2 and 9) + and (t1.doc11.int <= t2.doc21.int and t2.doc21.int <= t3.doc31.int); + +select t1.doc11.int, t2.doc21.int, t3.doc31.int +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.int between 1 and 12) and (t2.doc21.int between 2 and 10) and (t3.doc31.int between 2 and 9) + and (t1.doc11.int <= t2.doc21.int and t2.doc21.int <= t3.doc31.int); + +# bool +explain extended select t1.doc11.bool, t2.doc21.bool, t3.doc31.bool +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > t3.doc31.bool and t3.doc31.bool > 0; + +explain extended select t1.doc11.bool, t2.doc21.bool, t3.doc31.bool +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.bool between 1 and 2) and (t2.doc21.bool between 1 and 2) and (t3.doc31.bool between 0 and 1) + and (t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > t3.doc31.bool); + +# double +explain extended select t1.doc11.double, t2.doc21.double, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double and t3.doc31.double > 10.1; + +--echo NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.double, t2.doc21.double, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double and t3.doc31.double > 10.5; + +explain extended select t1.doc11.double, t2.doc21.double, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.double between 0.1 and 99.9) and (t2.doc21.double between 1.1 and 11.11) and (t3.doc31.double between 2.2 and 12.12) + and (t1.doc11.double <= t2.doc21.double and t2.doc21.double <= t3.doc31.double); + +select t1.doc11.double, t2.doc21.double, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.double between 0.1 and 99.9) and (t2.doc21.double between 1.1 and 11.11) and (t3.doc31.double between 2.2 and 12.12) + and (t1.doc11.double <= t2.doc21.double and t2.doc21.double <= t3.doc31.double); + +# string +explain extended select t1.doc11.string, t2.doc21.string, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string >= t2.doc21.string and t2.doc21.string >= t3.doc31.string and t3.doc31.string >= 'aa'; + +select t1.doc11.string, t2.doc21.string, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string >= t2.doc21.string and t2.doc21.string >= t3.doc31.string and t3.doc31.string >= 'aa'; + +explain extended select t1.doc11.string, t2.doc21.string, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.string between 'a' and 'xxx') and (t2.doc21.string between 'aa' and 'kkk') and (t3.doc31.string between 'aaa' and 'jjj') + and (t1.doc11.string >= t2.doc21.string and t2.doc21.string >= t3.doc31.string); + +select t1.doc11.string, t2.doc21.string, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.string between 'a' and 'xxx') and (t2.doc21.string between 'aa' and 'kkk') and (t3.doc31.string between 'aaa' and 'jjj') + and (t1.doc11.string >= t2.doc21.string and t2.doc21.string >= t3.doc31.string); + +## +## non-covering index for three table range join +## + +# int +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.int > t2.doc21.int and t2.doc21.int > t3.doc31.int and t3.doc31.int > 10; + +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.int between 0 and 13) and (t2.doc21.int between 1 and 12) and (t3.doc31.int between 2 and 11) + and (t1.doc11.int >= t2.doc21.int and t2.doc21.int >= t3.doc31.int); + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.int between 0 and 13) and (t2.doc21.int between 1 and 12) and (t3.doc31.int between 2 and 11) + and (t1.doc11.int >= t2.doc21.int and t2.doc21.int >= t3.doc31.int); + +# bool +explain extended select t1.doc11.int, t1.doc11.bool, t2.doc21.int, t2.doc21.bool, t3.doc31.int, t3.doc31.bool +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > t3.doc31.bool and t3.doc31.bool > 0; + +explain extended select t1.doc11.int, t1.doc11.bool, t2.doc21.int, t2.doc21.bool, t3.doc31.int, t3.doc31.bool +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.bool between 1 and 2) and (t2.doc21.bool between 1 and 2) and (t3.doc31.bool between 0 and 1) + and (t1.doc11.bool > t2.doc21.bool and t2.doc21.bool > t3.doc31.bool); + +# double +explain extended select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double and t3.doc31.double > 10.1; + +--echo NOT-A-BUG: Caused by the inaccuracy of double in MySQL +select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.double > t2.doc21.double and t2.doc21.double > t3.doc31.double and t3.doc31.double > 10.5; + +explain extended select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.double between 1.1 and 11.11) and (t2.doc21.double between 2.1 and 12.12) and (t3.doc31.double between 2.2 and 10.10) + and (t1.doc11.double <= t2.doc21.double and t2.doc21.double <= t3.doc31.double); + +select t1.doc11.int, t1.doc11.double, t2.doc21.int, t2.doc21.double, t3.doc31.int, t3.doc31.double +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.double between 1.1 and 11.11) and (t2.doc21.double between 2.1 and 12.12) and (t3.doc31.double between 2.2 and 10.10) + and (t1.doc11.double <= t2.doc21.double and t2.doc21.double <= t3.doc31.double); + +# string +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > t3.doc31.string and t3.doc31.string > 'ggg'; + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where t1.doc11.string > t2.doc21.string and t2.doc21.string > t3.doc31.string and t3.doc31.string > 'ggg'; + +explain extended select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.string between 'a' and 'jjj') and (t2.doc21.string between 'aa' and 'iii') and (t3.doc31.string between 'aaa' and 'kkk') + and (t1.doc11.string <= t2.doc21.string and t2.doc21.string <= t3.doc31.string); + +select t1.doc11.int, t1.doc11.string, t2.doc21.int, t2.doc21.string, t3.doc31.int, t3.doc31.string +from t1 use document keys, t2 use document keys, t3 use document keys +where (t1.doc11.string between 'a' and 'jjj') and (t2.doc21.string between 'aa' and 'iii') and (t3.doc31.string between 'aaa' and 'kkk') + and (t1.doc11.string <= t2.doc21.string and t2.doc21.string <= t3.doc31.string); + # # clean up # -drop table t1; +drop table t1, t2, t3; --source include/rpl_end.inc diff --git a/sql/field.cc b/sql/field.cc index a76e8f79436c..66d244e0bc51 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -6844,19 +6844,8 @@ Field_string::store(const char *from,uint length,const CHARSET_INFO *cs) /* Append spaces if the string was shorter than the field. */ if (copy_length < field_length) { - /* - Here if it's from the index we use 0x20 as the padding. - Now when there is an index on Field_document for type - string, 0x20 will be used as the padding. It's not good, - because, now we have to get the data from the original - data which is not efficient. Actually, if using zero as - the paddings, it should be faster because we don't need - to get it from the original data. Need to be fixed. - */ field_charset->cset->fill(field_charset,(char*) ptr+copy_length, field_length-copy_length, - document_key_field ? - 0x20 : field_charset->pad_char); } @@ -8993,7 +8982,28 @@ Field_document::update_json(const fbson::FbsonValue *val, fbson::FbsonDocument *doc = fbson::FbsonDocument::createDocument(blob, value.length()); - DBUG_ASSERT(doc); + // Build the document path and set the value. This may happen from + // call save_value_and_handle_conversion() during range optimizations + // for example 'where t.doc.int > 5' + if (!doc) { + DBUG_ASSERT(update_args == nullptr); + // If val is nullptr, which means deletion, + // or if update is only allowed with "IF EXISTS" argument. + if ((val == nullptr) || + (from->update_args && from->update_args->exist_type == + Save_in_field_args::CheckType::CHECK_EXISTS)) + { + return TYPE_ERR_BAD_VALUE; + } + + fbson::FbsonWriter writer; + Document_path_iterator path = key_path; + path++; + const fbson::FbsonValue *v = build_path(path, writer, val, + fbson::FbsonType::T_Object); + Document_path_iterator p(this); + return update_json(v, cs, p, this); + } fbson::FbsonUpdater updater(doc, buffer_len); Document_path_iterator path = key_path; @@ -9073,6 +9083,7 @@ Field_document *Field_document::new_field(MEM_ROOT *root, append_key_path(new_one->prefix_document_key_path, document_key_path); new_one->doc_type = doc_type; + new_one->key_len = key_len; new_one->prefix_path_num = prefix_path_num + document_key_path.elements; return new_one; } @@ -9150,6 +9161,7 @@ Field_document::store(double nr) return real_field()-> update_json(creater(nr), charset(), path, this); } + // prepare the buffer in value type_conversion_status Field_document::prepare_update(const CHARSET_INFO *cs, @@ -9161,15 +9173,25 @@ Field_document::prepare_update(const CHARSET_INFO *cs, */ DBUG_ASSERT(this == real_field()); - // Null column can't use partial update. + // New document will be created and the document path + // will be built for partial update for null column + // if argument CHECK_EXISTS is not specified, i.e., + // the argument is CHECK_NONE or CHECK_NOTEXISTS. char *blob = nullptr; memcpy(&blob, ptr + packlength, sizeof(char*)); - if(is_null() || nullptr == blob) + if(nullptr == blob) { - set_null(); - return TYPE_ERR_BAD_VALUE; + // Allocate memory if it is not allocated yet. It will + // be reallocated later if it is not big enough. + if(value.alloc(128)) { + *buff = nullptr; + return TYPE_ERR_OOM; + } + memset(value.c_ptr(), 0, value.alloced_length()); + *buff = value.c_ptr(); + return TYPE_OK; } // If the buffer has been allocated, then it's fine. @@ -9179,6 +9201,8 @@ Field_document::prepare_update(const CHARSET_INFO *cs, *buff = blob; return TYPE_OK; } + + // Otherwise, allocate the buffer. int len = get_length(ptr); if(value.realloc(len * 2)){ *buff = nullptr; @@ -9770,12 +9794,15 @@ bool Field_document::is_null_as_blob(my_ptrdiff_t row_offset) const{ } bool Field_document::is_null(my_ptrdiff_t row_offset) const{ - Field_document *real = const_cast(this)->real_field(); - if(real == this && Field_blob::is_null(row_offset)) + // Check if the actual blob is null + if (is_null_as_blob(row_offset)) return true; + + // Check the actual data in the blob if(is_from_index()) { char *blob = nullptr; + Field_document *real = const_cast(this)->real_field(); memcpy(&blob, real->ptr+packlength, sizeof(char*)); if(nullptr == blob) return true; @@ -9794,11 +9821,13 @@ Field_document::Field_document(MEM_ROOT *mem_root, Field_document *document, List &doc_path, enum_field_types type, - uint key_len): + uint key_length): Field_document(*document) { DBUG_ASSERT(doc_path.elements > 0); - key_length = key_len; + key_len = key_length; + set_document_type(type); + DBUG_ASSERT(validate_doc_type()); inner_field = document; document_key_path.empty(); List_iterator it(doc_path); @@ -9810,7 +9839,6 @@ Field_document::Field_document(MEM_ROOT *mem_root, field_name = gen_document_path_full_name(mem_root, document->field_name, document_key_path); - set_document_type(type); } Field_document::Field_document(MEM_ROOT *mem_root, Field_document *document, @@ -9853,7 +9881,7 @@ Field_document::Field_document(MEM_ROOT *mem_root, table->merge_keys.merge(trie->part_of_key); set_document_type(trie->key_type); found_doc_idx = true; - key_length = trie->key_length; + key_len = trie->key_length; } } @@ -9864,9 +9892,10 @@ Field_document::Field_document(MEM_ROOT *mem_root, */ table->covering_keys.intersect(part_of_key); table->merge_keys.merge(part_of_key); - key_length = 0; + key_len = 0; } } + DBUG_ASSERT(validate_doc_type()); } fbson::FbsonValue *Field_document::get_fbson_value() @@ -9932,10 +9961,11 @@ uint Field_document::get_key_image(uchar *buff, uint length, return get_key_image_text(buff, length, fb_val); default: - DBUG_ASSERT(0); - // we should never have a unsupported key type - return 0; + break; } + // should never reach here + DBUG_ASSERT(0); + return 0; } // get key image as int @@ -9956,10 +9986,8 @@ uint Field_document::get_key_image_int(uchar *buff, fbson::FbsonValue *pval) val = 0; return 0; } - return sizeof(int64_t); } - return get_key_image_numT(val, pval); } @@ -10030,7 +10058,6 @@ uint Field_document::get_key_image_bool(uchar *buff, fbson::FbsonValue *pval) default: return 0; } - return 1; } @@ -10041,8 +10068,9 @@ uint Field_document::get_key_image_text(uchar *buff, uint length, { DBUG_ASSERT(pval); - char local_buf[64]; // enough buffer to store number value as string + char *p = NULL; uint copy_len = 0; + char local_buf[64]; switch (pval->type()) { case fbson::FbsonType::T_Int8: @@ -10062,19 +10090,46 @@ uint Field_document::get_key_image_text(uchar *buff, uint length, break; case fbson::FbsonType::T_String: case fbson::FbsonType::T_Binary: + { copy_len = min(length, pval->size()); - memmove(buff, pval->getValuePtr(), copy_len); - return copy_len; - + p = (char *)pval->getValuePtr(); + break; + } case fbson::FbsonType::T_True: + longlong2str(1, local_buf, -10); + break; case fbson::FbsonType::T_False: + longlong2str(0, local_buf, -10); + break; + default: + // should never reach here + DBUG_ASSERT(0); return 0; } - copy_len = min(length, strlen(local_buf)); - memmove(buff, local_buf, copy_len); - return copy_len; + // It is not from string + if (p == NULL) + { + DBUG_ASSERT(copy_len == 0); + copy_len = strlen(local_buf); + p = local_buf; + } + + uint local_char_len = copy_len / field_charset->mbmaxlen; + local_char_len = my_charpos(field_charset, p, p+copy_len, local_char_len); + set_if_smaller(copy_len, local_char_len); + + // Key length is always stored with 2 bytes + int2store(buff, copy_len); + memcpy(buff+HA_KEY_BLOB_LENGTH, p, copy_len); + if (copy_len < length) + { + // Must clear this as we do a memcmp in opt_range.cc + // to detect identical keys + memset(buff+HA_KEY_BLOB_LENGTH+copy_len, 0, (length-copy_len)); + } + return (HA_KEY_BLOB_LENGTH + copy_len); } // Templated helper for get_key_image_[int, double] @@ -10108,12 +10163,112 @@ uint Field_document::get_key_image_numT(T &val, fbson::FbsonValue *pval) val = (T)((fbson::DoubleVal *)pval)->val(); break; default: + // should never reach here + DBUG_ASSERT(0); return 0; } - return sizeof(T); } +int Field_document::key_cmp(const uchar *x, const uchar*y) +{ + switch (doc_type) { + case DOC_PATH_TINY: + { + int8_t a = *(char*)x; + int8_t b = *(char*)y; + return (a < b ? -1 : (a > b ? 1 : 0)); + } + case DOC_PATH_INT: + { + int64_t a = *(int64_t*)x; + int64_t b = *(int64_t*)y; + return (a < b ? -1 : (a > b ? 1 : 0)); + } + case DOC_PATH_DOUBLE: + { + double a = *(double*)x; + double b = *(double*)y; + return (a < b ? -1 : (a > b ? 1 : 0)); + } + case DOC_PATH_STRING: + return field_charset->coll->strnncollsp(field_charset, + x + HA_KEY_BLOB_LENGTH, + uint2korr(x), + y + HA_KEY_BLOB_LENGTH, + uint2korr(y), 0); + default: + break; + } + // should never reach here + DBUG_ASSERT(0); + return 0; +} + +int Field_document::key_cmp(const uchar *key_ptr, + uint max_key_length) +{ + switch (doc_type) { + case DOC_PATH_TINY: + DBUG_ASSERT(max_key_length >= 1); + if (max_key_length >= 1) + { + // Raw value in MySQL little endian format + int8_t k = *(int8_t*)key_ptr; + // Raw value in InnoDB big endian format is stored in document blob + int64_t x = this->val_int(); + return (x < k ? -1 : (x > k ? 1 : 0)); + } + + case DOC_PATH_INT: + DBUG_ASSERT(max_key_length >= sizeof(int64_t)); + if (max_key_length >= sizeof(int64_t)) + { + int64_t k = *(int64_t*)key_ptr; + int64_t x = this->val_int(); + return (x < k ? -1 : (x > k ? 1 : 0)); + } + + case DOC_PATH_DOUBLE: + DBUG_ASSERT(max_key_length >= sizeof(double)); + if (max_key_length >= sizeof(double)) + { + double k = *(double*)key_ptr; + double x = this->val_real(); + return (x < k ? -1 : (x > k ? 1 : 0)); + } + + case DOC_PATH_STRING: + { + String val, ptr; + String *x = this->val_str(&val, &ptr); + if (x && x->ptr() && key_ptr) + { + const uchar* p = (const uchar*)x->ptr(); + uint len = x->length(); + uint local_char_len = max_key_length / field_charset->mbmaxlen; + local_char_len = my_charpos(field_charset, p, p+len, local_char_len); + set_if_smaller(len, local_char_len); + return field_charset->coll->strnncollsp(field_charset, p, len, + key_ptr + HA_KEY_BLOB_LENGTH, + uint2korr(key_ptr), 0); + } + } + default: + break; + } + // should never reach here + DBUG_ASSERT(0); + return 0; +} + +uint32 Field_document::key_length() const +{ + DBUG_ASSERT(validate_doc_type()); + return key_len; +} + + /**************************************************************************** ** enum type. ** This is a string which only can have a selection of different values. diff --git a/sql/field.h b/sql/field.h index ca9ef4ce5f2d..4c074f52d403 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1054,7 +1054,7 @@ class Field MY_TEST(null_ptr[row_offset] & null_bit) : table->null_row; } - bool is_real_null(my_ptrdiff_t row_offset= 0) const + virtual bool is_real_null(my_ptrdiff_t row_offset= 0) const { return real_maybe_null() ? MY_TEST(null_ptr[row_offset] & null_bit) : false; } bool is_null_in_record(const uchar *record) const @@ -3276,13 +3276,6 @@ class Field_datetimef :public Field_temporal_with_date_and_timef { class Field_string :public Field_longstr { public: - /* - This varaible is used when we do padding and should also be removed - once we can use 0 as the padding for index. - When true, it's created from an index using old style. Otherwise, - it's false. - */ - bool document_key_field = false; bool can_alter_field_type; Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, uchar null_bit_arg, @@ -3369,6 +3362,10 @@ class Field_string :public Field_longstr { class Field_varstring :public Field_longstr { public: + /* + If this field is created for a document path key with string type. + */ + bool document_key_field = false; /* The maximum space available in a Field_varstring, in bytes. See length_bytes. @@ -3735,7 +3732,7 @@ class Field_document :public Field_blob { protected: const Field_document *get_inner_field() const { return const_cast(this)->get_inner_field(); } - uint key_length; // The length of the key defined in the index + uint key_len; // The length of the key defined in the index public: friend class Document_path_iterator; enum document_type doc_type; @@ -3804,7 +3801,7 @@ class Field_document :public Field_blob { TABLE_SHARE *share, uint blob_pack_length) :Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, share, blob_pack_length, &my_charset_bin), - key_length(0), doc_type(DOC_DOCUMENT), prefix_path_num(0), + key_len(0), doc_type(DOC_DOCUMENT), prefix_path_num(0), doc_key_prefix_len(0), update_args(nullptr), inner_field(nullptr) { init(); @@ -3812,7 +3809,7 @@ class Field_document :public Field_blob { Field_document(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, TABLE_SHARE *share) :Field_blob(len_arg, maybe_null_arg, field_name_arg, &my_charset_bin), - key_length(0), doc_type(DOC_DOCUMENT), prefix_path_num(0), + key_len(0), doc_type(DOC_DOCUMENT), prefix_path_num(0), doc_key_prefix_len(0), update_args(nullptr), inner_field(nullptr) { init(); @@ -3831,7 +3828,7 @@ class Field_document :public Field_blob { Field_document *document, List &doc_path, enum_field_types type, - uint key_len); + uint key_length); /* Create a Field_document by a document path, but skip the first skip_num @@ -3849,7 +3846,7 @@ class Field_document :public Field_blob { Check whether this field is created based on the other field, such as a document path. */ - bool is_derived_document_field() + bool is_derived_document_field() const { return real_field() != this; } @@ -3865,15 +3862,14 @@ class Field_document :public Field_blob { uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) { - if(DOC_DOCUMENT != doc_type) - DBUG_ASSERT(key_length > 0); + DBUG_ASSERT(validate_doc_type()); Field *field = nullptr; switch(doc_type) { case DOC_PATH_DOUBLE: field = new (root) Field_double(new_ptr, - key_length, + key_len, new_null_ptr, new_null_bit, unireg_check, @@ -3883,18 +3879,24 @@ class Field_document :public Field_blob { true); break; case DOC_PATH_STRING: - field= new (root) Field_string(new_ptr, - key_length, - new_null_ptr, - new_null_bit, - unireg_check, - field_name, - charset()); - ((Field_string*)field)->document_key_field = true; + { + /* Key segments are always packed with a 2-byte length + (HA_KEY_BLOB_LENGTH) prefix. See mi_rkey for details. + */ + field= new (root) Field_varstring(new_ptr, key_len, + HA_KEY_BLOB_LENGTH, + new_null_ptr, + new_null_bit, + Field::NONE, + field_name, + new_table->s, + charset()); + ((Field_varstring*)field)->document_key_field = true; break; + } case DOC_PATH_INT: field = new (root) Field_longlong(new_ptr, - key_length, + key_len, new_null_ptr, new_null_bit, unireg_check, @@ -3904,7 +3906,7 @@ class Field_document :public Field_blob { break; case DOC_PATH_TINY: field = new (root) Field_tiny(new_ptr, - key_length, + key_len, new_null_ptr, new_null_bit, unireg_check, @@ -3941,6 +3943,12 @@ class Field_document :public Field_blob { get_inner_field()->real_field() : this; } + const Field_document *real_field() const + { + return get_inner_field() != nullptr ? + get_inner_field()->real_field() : + this; + } /* Check if it is null as a blob, during which only flags will be checked. @@ -3955,6 +3963,12 @@ class Field_document :public Field_blob { enum_field_types type() const { return MYSQL_TYPE_DOCUMENT; } bool match_collation_to_optimize_range() const { return false; } uint get_key_image(uchar *buff, uint length, imagetype type); + void set_key_image(const uchar *buff, uint length) { + Field_blob::set_key_image(buff, length); + } + int key_cmp(const uchar *,const uchar*); + int key_cmp(const uchar *str, uint length); + uint32 key_length() const; void sql_type(String &str) const; using Field_blob::store; @@ -4016,6 +4030,12 @@ class Field_document :public Field_blob { get_document_type(); } + bool is_doc_type_string() + { + DBUG_ASSERT(validate_doc_type()); + return (doc_type == DOC_PATH_STRING); + } + void set_document_type(enum_field_types type) { switch (type) @@ -4029,13 +4049,58 @@ class Field_document :public Field_blob { } } + bool validate_doc_type() const + { + switch (doc_type) + { + case DOC_PATH_TINY: + return (key_len == 1); + case DOC_PATH_INT: + return (key_len == sizeof(int64_t)); + case DOC_PATH_DOUBLE: + return (key_len == sizeof(double)); + case DOC_PATH_STRING: + return (key_len > 0); + case DOC_DOCUMENT: + return (key_len == 0); + default: + break; + } + DBUG_ASSERT(false); //not supported + return false; + } + + Item_result result_type() const + { + switch (doc_type) + { + case DOC_PATH_TINY: + case DOC_PATH_INT: + return INT_RESULT; + + case DOC_PATH_DOUBLE: + return REAL_RESULT; + + case DOC_PATH_STRING: + case DOC_DOCUMENT: + return STRING_RESULT; + + default: + break; + } + // Should never reach here. + DBUG_ASSERT(false); + return STRING_RESULT; + } + /* This overwrites the base version. * Note: document column should always nullable. * We keep the document path logic below (which is no longer needed) for now * - If the field is a document path, it can always be nullable. For example, * when document path is in the select, prefix_path_num is non-zero. When * document path used in partial update, update_args is non-null. When - * document path is used in ORDER BY, get_inner_field() is non-null */ + * document path is used in ORDER BY, get_inner_field() is non-null + */ bool real_maybe_null(void) const { // document column should always be nullable @@ -4044,6 +4109,18 @@ class Field_document :public Field_blob { (prefix_path_num || update_args || get_inner_field()); } + bool is_real_null(my_ptrdiff_t row_offset= 0) const + { + return Field_blob::real_maybe_null() && is_null(row_offset); + } + + bool is_real_null_as_blob(my_ptrdiff_t row_offset= 0) const + { + if (Field_blob::real_maybe_null()) + return MY_TEST(null_ptr[row_offset] & null_bit); + return false; + } + Field_document *clone(MEM_ROOT *mem_root) const { return new (mem_root) Field_document(*this); @@ -4062,6 +4139,10 @@ class Field_document :public Field_blob { } fbson::FbsonValue *get_fbson_value(); void set_prefix_document_path(List &pre); + void reset_as_blob() + { + Field_blob::reset(); + } protected: /* This variable is the place where document path is stored. diff --git a/sql/key.cc b/sql/key.cc index 26d0563c0f18..b443aa1ee2b7 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -127,15 +127,21 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, key_part->null_bit); key_length--; } + if (key_part->document_path_key_part) { - // we handle document path key separately (similar to blob) + uint ha_key_blob_len = + (key_part->document_path_key_part->type == MYSQL_TYPE_STRING) ? + HA_KEY_BLOB_LENGTH : 0; + + key_length-= ha_key_blob_len; length= min(key_length, key_part->document_path_key_part->length); Field_document *field= (Field_document*)(key_part->field); my_ptrdiff_t ptrdiff= from_record - field->table->record[0]; field->move_field_offset(ptrdiff); field->get_key_image(to_key, length, Field::itRAW); field->move_field_offset(-ptrdiff); + to_key+= ha_key_blob_len; } else if (key_part->key_part_flag & HA_BLOB_PART || key_part->key_part_flag & HA_VAR_LENGTH_PART) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index df34ed8e0dba..85dfcddd6b07 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -6548,12 +6548,6 @@ get_mm_parts(RANGE_OPT_PARAM *param, Item_func *cond_func, Field *field, is_spatial_operator(cond_func->functype())) continue; - /* TODO: currently we skip range analysis optimization - * for document fields - */ - if (field->type() == MYSQL_TYPE_DOCUMENT) - continue; - SEL_ARG *sel_arg=0; if (!tree && !(tree=new SEL_TREE())) DBUG_RETURN(0); // OOM @@ -7020,6 +7014,12 @@ get_mm_leaf(RANGE_OPT_PARAM *param, Item *conf_func, Field *field, goto end; } + if (field->type() == MYSQL_TYPE_DOCUMENT) + { + // Clean up the document blob. + Field_document *field_document = (Field_document *)field; + field_document->reset_as_blob(); + } if (save_value_and_handle_conversion(&tree, value, type, field, &impossible_cond_cause, alloc)) goto end; diff --git a/sql/sql_tmp_table.cc b/sql/sql_tmp_table.cc index 2f763d4f20ec..87f02083d63a 100644 --- a/sql/sql_tmp_table.cc +++ b/sql/sql_tmp_table.cc @@ -1027,7 +1027,17 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, diff= (my_ptrdiff_t) (orig_field->table->s->default_values- orig_field->table->record[0]); orig_field->move_field_offset(diff); // Points now at default_values - if (orig_field->is_real_null()) + bool real_null = false; + if (orig_field->type() == MYSQL_TYPE_DOCUMENT) + { + Field_document *doc = (Field_document *)orig_field; + real_null = doc->is_real_null_as_blob(); + } + else + { + real_null = orig_field->is_real_null(); + } + if (real_null) field->set_null(); else { diff --git a/sql/table.cc b/sql/table.cc index 144ce6e34b82..0a7cf63a38f4 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -832,12 +832,22 @@ void KEY_PART_INFO::init_from_field(Field *fld) document field since key part only can be built on a document path with a primary type */ + bool is_string_type_document_key = false; + if (field->type() == MYSQL_TYPE_DOCUMENT) + { + /* a document field is always nullable */ + DBUG_ASSERT(field->real_maybe_null()); + + is_string_type_document_key = + ((Field_document*)field)->is_doc_type_string(); + } if (field->real_maybe_null()) store_length+= HA_KEY_NULL_LENGTH; if (field->type() == MYSQL_TYPE_BLOB || field->real_type() == MYSQL_TYPE_VARCHAR || - field->type() == MYSQL_TYPE_GEOMETRY) + field->type() == MYSQL_TYPE_GEOMETRY || + is_string_type_document_key) { store_length+= HA_KEY_BLOB_LENGTH; } @@ -2080,7 +2090,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, field= key_part->field= share->field[key_part->fieldnr-1]; key_part->type= field->key_type(); - /* sanity check for document path key part */ + bool is_string_type_document_key = false; if (field->type() == MYSQL_TYPE_DOCUMENT) { /* since a field with document type cannot be a key part @@ -2091,11 +2101,15 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, field->field_name) == 0); /* the document path flag has been removed */ DBUG_ASSERT(f_is_document(key_part->key_type)); + + /* a document field is always nullable */ + DBUG_ASSERT(field->real_maybe_null()); + + is_string_type_document_key = + (key_part->document_path_key_part->type == MYSQL_TYPE_STRING); } - /* When field is a document, a doc path can always be nullable so the - * null bit and other flags should still be set */ - if (field->type() == MYSQL_TYPE_DOCUMENT || field->real_maybe_null()) + if (field->real_maybe_null()) { key_part->null_offset=field->null_offset(share->default_values); key_part->null_bit= field->null_bit; @@ -2105,7 +2119,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, } if (field->type() == MYSQL_TYPE_BLOB || field->real_type() == MYSQL_TYPE_VARCHAR || - field->type() == MYSQL_TYPE_GEOMETRY) + field->type() == MYSQL_TYPE_GEOMETRY || + is_string_type_document_key) { key_part->store_length+=HA_KEY_BLOB_LENGTH; if (i + 1 <= keyinfo->user_defined_key_parts) @@ -2126,7 +2141,10 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, for MyRocks */ } - if (field->key_length() != key_part->length) + + /* key_length() of document fields don't provide the length of keys */ + if (field->key_length() != key_part->length && + field->type() != MYSQL_TYPE_DOCUMENT) { #ifndef TO_BE_DELETED_ON_PRODUCTION if (field->type() == MYSQL_TYPE_NEWDECIMAL) diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 00c4d167046e..403ef7209d30 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2803,7 +2803,10 @@ set_doc_path_col( field->doc_path_col->mtype = DATA_DOUBLE; field->doc_path_col->len = sizeof(double); } else if (field->document_path_type == MYSQL_TYPE_STRING) { - field->doc_path_col->mtype = DATA_BINARY; + /* With type DATA_BLOB, 2-byte of key length will be packed + before the key. Also there will always be 1 byte for null value + before this length since a document key is always nullable. */ + field->doc_path_col->mtype = DATA_BLOB; field->doc_path_col->len = field->prefix_len; } else { DBUG_ASSERT("Unsupported document index type"); diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 5f525e153d1b..d3fb2f1c4ba0 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -5102,7 +5102,9 @@ row_search_for_mysql( index, secondary_index_field_no); ut_a(field->prefix_len > 0); - if (record_size >= field->prefix_len) { + if (record_size >= field->prefix_len || + /* Skip for document type */ + field->document_path) { row_contains_all_values = FALSE; break; }