Cutoff option while querying local distributed index #1661
Answered
by
sanikolaev
starinacool
asked this question in
Q&A
-
Setting the cutoff option in a query for a local distributed index cuts off matches per index or for the whole distributed index?
Will this query get at most 20 matches from listing2f and at most 20 matches from listing2? |
Beta Was this translation helpful? Give feedback.
Answered by
sanikolaev
Dec 6, 2023
Replies: 1 comment
-
Yes: mysql> drop table if exists t; create table t; drop table if exists t2; create table t2; drop table if exists dist; create table dist type='distributed' local='t' local='t2'; insert into t values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),(21),(22),(23),(24),(25); insert into t2 values(111),(112),(113),(114),(115),(116),(117),(118),(119),(1110),(1111),(1112),(1113),(1114),(1115),(1116),(1117),(1118),(1119),(1120),(1121),(1122),(1123),(1124),(1125); select * from dist limit 100 option cutoff=20;
--------------
drop table if exists t
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
create table t
--------------
Query OK, 0 rows affected (0.01 sec)
--------------
drop table if exists t2
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
create table t2
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
drop table if exists dist
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
create table dist type='distributed' local='t' local='t2'
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
insert into t values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),(21),(22),(23),(24),(25)
--------------
Query OK, 25 rows affected (0.00 sec)
--------------
insert into t2 values(111),(112),(113),(114),(115),(116),(117),(118),(119),(1110),(1111),(1112),(1113),(1114),(1115),(1116),(1117),(1118),(1119),(1120),(1121),(1122),(1123),(1124),(1125)
--------------
Query OK, 25 rows affected (0.00 sec)
--------------
select * from dist limit 100 option cutoff=20
--------------
+------+
| id |
+------+
| 111 |
| 1 |
| 2 |
| 112 |
| 3 |
| 113 |
| 4 |
| 114 |
| 115 |
| 5 |
| 116 |
| 6 |
| 117 |
| 7 |
| 8 |
| 118 |
| 119 |
| 9 |
| 10 |
| 1110 |
| 11 |
| 1111 |
| 12 |
| 1112 |
| 13 |
| 1113 |
| 14 |
| 1114 |
| 15 |
| 1115 |
| 1116 |
| 16 |
| 1117 |
| 17 |
| 18 |
| 1118 |
| 19 |
| 1119 |
| 1120 |
| 20 |
+------+
40 rows in set (0.00 sec)
--- 40 out of >=40 results in 0ms --- |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
starinacool
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes: