Last active
March 2, 2021 15:13
-
-
Save den-crane/7a59c05db1c51631bd595900e44f3271 to your computer and use it in GitHub Desktop.
Map benchm
This file contains hidden or 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
| set allow_experimental_map_type=1 | |
| create table b( A Int64, K Array(String), V Array(String), KV Map(String, String) ) Engine=MergeTree order by A; | |
| insert into b select number x, | |
| arrayMap( i -> toString(i), range(20) ) K, | |
| arrayMap( i -> toString(cityHash64(x,i)), range(20) ) V, | |
| (K,V) | |
| from numbers(10000000); | |
| select max(V[indexOf(K,'1')]) from b ; | |
| Elapsed: 1.801 sec. | |
| select max(KV['1']) from b; | |
| Elapsed: 1.624 sec | |
| select count() from b where V[indexOf(K,'1')] = '9999998732337378585' | |
| Elapsed: 1.475 sec. | |
| select count() from b where KV['1'] = '9999998732337378585' | |
| Elapsed: 1.462 sec. | |
| select count() from b where has(K, '6'); | |
| Elapsed: 0.270 sec | |
| select count() from b where mapContains(KV, '6'); | |
| Elapsed: 1.459 sec | |
| select count() from b where has(KV.keys, '6'); | |
| Elapsed: 0.253 sec. | |
| select count() from b where V[indexOf(K,'1')] = '9999998732337378585' and V[indexOf(K,'5')] = '42'; | |
| Elapsed: 1.553 sec | |
| select count() from b where KV['1'] = '9999998732337378585' and KV['5'] = '42'; | |
| Elapsed: 1.627 sec. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment