-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Manan Gupta <[email protected]> Co-authored-by: Manan Gupta <[email protected]>
- Loading branch information
1 parent
4c8bff1
commit 7bba3a0
Showing
9 changed files
with
305 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
CREATE TABLE `t1` | ||
( | ||
`id` int unsigned NOT NULL AUTO_INCREMENT, | ||
`name` varchar(191) NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE InnoDB, | ||
CHARSET utf8mb4, | ||
COLLATE utf8mb4_unicode_ci; | ||
|
||
CREATE TABLE `t2` | ||
( | ||
`id` bigint unsigned NOT NULL AUTO_INCREMENT, | ||
`t1_id` int unsigned NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE InnoDB, | ||
CHARSET utf8mb4, | ||
COLLATE utf8mb4_unicode_ci; | ||
|
||
CREATE TABLE `t3` | ||
( | ||
`id` bigint unsigned NOT NULL AUTO_INCREMENT, | ||
`name` varchar(191) NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE InnoDB, | ||
CHARSET utf8mb4, | ||
COLLATE utf8mb4_unicode_ci; | ||
|
||
CREATE TABLE `t4` | ||
( | ||
`id` bigint unsigned NOT NULL AUTO_INCREMENT, | ||
`col` int unsigned NOT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE InnoDB, | ||
CHARSET utf8mb4, | ||
COLLATE utf8mb4_unicode_ci; | ||
|
||
insert into t1 (id, name) | ||
values (1, 'A'), | ||
(2, 'B'), | ||
(3, 'C'), | ||
(4, 'D'); | ||
|
||
insert into t2 (id, t1_id) | ||
values (1, 1), | ||
(2, 2), | ||
(3, 3); | ||
|
||
insert into t3 (id, name) | ||
values (1, 'A'), | ||
(2, 'B'), | ||
(3, 'B'), | ||
(4, 'B'), | ||
(5, 'B'); | ||
|
||
insert into t4 (id, col) | ||
values (1, 1), | ||
(2, 2), | ||
(3, 3); | ||
|
||
-- wait_authoritative t1 | ||
-- wait_authoritative t2 | ||
-- wait_authoritative t3 | ||
select 42 | ||
from t1 | ||
join t2 on t1.id = t2.t1_id | ||
join t3 on t1.id = t3.id | ||
where t1.name | ||
or t2.id | ||
or t3.name; | ||
|
||
# Complex query that requires hash join underneath a memory sort and ordered aggregate | ||
select 1 | ||
from t1 | ||
join t2 on t1.id = t2.t1_id | ||
join t4 on t4.col = t2.id | ||
left join (select t4.col, count(*) as count from t4 group by t4.col) t3 on t3.col = t2.id | ||
where t1.id IN (1, 2) | ||
group by t2.id, t4.col; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"keyspaces": { | ||
"joinks": { | ||
"sharded": true, | ||
"vindexes": { | ||
"hash": { | ||
"type": "hash" | ||
} | ||
}, | ||
"tables": { | ||
"t1": { | ||
"column_vindexes": [ | ||
{ | ||
"column": "id", | ||
"name": "hash" | ||
} | ||
] | ||
}, | ||
"t2": { | ||
"column_vindexes": [ | ||
{ | ||
"column": "t1_id", | ||
"name": "hash" | ||
} | ||
] | ||
}, | ||
"t3": { | ||
"column_vindexes": [ | ||
{ | ||
"column": "id", | ||
"name": "hash" | ||
} | ||
] | ||
}, | ||
"t4": { | ||
"column_vindexes": [ | ||
{ | ||
"column": "id", | ||
"name": "hash" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.