Skip to content

Instantly share code, notes, and snippets.

@matriv
Last active April 17, 2018 18:27
Show Gist options
  • Save matriv/35fa9daedb7f5b390051976a5e0d135b to your computer and use it in GitHub Desktop.
Save matriv/35fa9daedb7f5b390051976a5e0d135b to your computer and use it in GitHub Desktop.
####### SETUP #######
CREATE TABLE t1(
id1 int,
id2 int
) with (number_of_replicas=0);
CREATE TABLE t2(
id1 int,
id2 int
) with (number_of_replicas=0);
t1.id1 = t2.id1: all rows match
t1.id1 = t2.id1 and t1.id2 = t2.id2: 1/5 of the rows match
############# HASH Joins ##############
1 condition: 3.616 ± 0.014
2 conditions: 5.400 ± 0.054
## Running Query:
Statement: select t1.id1, t2.id1 from t1 inner join t2 on t1.id1=t2.id1 limit 100
Concurrency: 1
Iterations: 20000
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20000/20000 [01:37<00:00, 205.88 requests/s]
Runtime (in ms):
mean: 3.616 ± 0.014
min/max: 2.852 → 16.409
Percentile:
50: 3.204 ± 1.041 (stdev)
95: 5.550
99.9: 11.227
## Running Query:
Statement: select t1.id1, t2.id1 from t1 inner join t2 on t1.id1=t2.id1 and t1.id
Concurrency: 1
Iterations: 20000
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20000/20000 [02:14<00:00, 149.19 requests/s]
Runtime (in ms):
mean: 5.400 ± 0.054
min/max: 3.958 → 112.241
Percentile:
50: 4.673 ± 3.881 (stdev)
95: 11.638
99.9: 17.454
############# NL Joins ##############
1 condition: 1142.210 ± 4.528
2 conditions: 10092.506 ± 199.722
## Running Query:
Statement: select t1.id1, t2.id1 from t1, t2 where t1.id1=t2.id1 limit 1000
Concurrency: 1
Iterations: 100
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [01:54<00:00, 1.14s/ requests]
Runtime (in ms):
mean: 1142.210 ± 4.528
min/max: 1095.904 → 1236.285
Percentile:
50: 1137.990 ± 23.100 (stdev)
95: 1180.826
99.9: 1236.285
## Running Query:
Statement: select t1.id1, t2.id1 from t1, t2 where t1.id1=t2.id1 and t1.id2=t2.id
Concurrency: 1
Iterations: 100
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [16:49<00:00, 10.01s/ requests]
Runtime (in ms):
mean: 10092.506 ± 199.722
min/max: 9582.549 → 16612.414
Percentile:
50: 9880.105 ± 1018.990 (stdev)
95: 10777.751
99.9: 16612.414
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment