When querying for a row by a hash, the performance is quite jumpy - event after initial query compilation.
I think it depends on what shard it hits, but the performance can be around 40 ms to 500ms.
My cluster is two leaves of 16 cores each and 60GB each of ram.
using SSD with 15K iops.
What should actually be expected?
The table is small with 400M entries.
Few examples ( shard key is senor_id
) hash key is pid
:
memsql> select * from process_relations limit 2 offset 100;
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
| sensor_id | pid | parent_pid | internal_id | event_id | generated_time |
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
| 0202bd29933f95946d25ab406371f5b2 | AdUvieStLcwAAA2IAAAAAA== | AdUt9BOL6UQAAAOMAAAAAA== | AdUvieStLcwAAA2IAAAAAA== | AAABa6pEY4/Egd6IAA48BA== | 2019-06-30 21:22:17.297000 |
| 0202bd29933f95946d25ab406371f5b2 | AdUvieTCm1UAAAT4AAAAAA== | AdUt9BOL6UQAAAOMAAAAAA== | AdUvieTCm1UAAAT4AAAAAA== | AAABa6pEZAzEgd6IAA48dA== | 2019-06-30 21:22:17.422000 |
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
2 rows in set (0.63 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='0202bd29933f95946d25ab406371f5b2' and pid='AdUt9BOL6UQAAAOMAAAAAA==' limit 1;
+----------------------------------+--------------------------+--------------------------+
| sensor_id | pid | parent_pid |
+----------------------------------+--------------------------+--------------------------+
| 0202bd29933f95946d25ab406371f5b2 | AdUt9BOL6UQAAAOMAAAAAA== | AdUt9BM9W9sAAALEAAAAAA== |
+----------------------------------+--------------------------+--------------------------+
1 row in set (0.77 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='0202bd29933f95946d25ab406371f5b2' and pid='AdUt9BM9W9sAAALEAAAAAA==' limit 1;
+----------------------------------+--------------------------+--------------------------+
| sensor_id | pid | parent_pid |
+----------------------------------+--------------------------+--------------------------+
| 0202bd29933f95946d25ab406371f5b2 | AdUt9BM9W9sAAALEAAAAAA== | AdUt9BMljhgAAAJ0AAAAAA== |
+----------------------------------+--------------------------+--------------------------+
1 row in set (0.18 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='0202bd29933f95946d25ab406371f5b2' and pid='AdUt9BMljhgAAAJ0AAAAAA==' limit 1;
+----------------------------------+--------------------------+--------------------+
| sensor_id | pid | parent_pid |
+----------------------------------+--------------------------+--------------------+
| 0202bd29933f95946d25ab406371f5b2 | AdUt9BMljhgAAAJ0AAAAAA== | |
+----------------------------------+--------------------------+--------------------+
1 row in set (0.22 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='0202bd29933f95946d25ab406371f5b2' and pid='AdUt9BMljhgAAAJ0AAAAAA==' limit 1;^C
memsql> select * from process_relations limit 2 offset 10000;
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
| sensor_id | pid | parent_pid | internal_id | event_id | generated_time |
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
| 006c3e15917ca1640caa9ab634661872 | AdUvkPzmhtwAAAWUAAAAAA== | AdUvfLERPeMAAAOMAAAAAA== | AdUvkPzmhtwAAAWUAAAAAA== | AAABa6py4k151APBAADG6w== | 2019-06-30 22:13:04.357000 |
| 006c3e15917ca1640caa9ab634661872 | AdUvkSceoHAAAAwMAAAAAA== | AdUvfLERPeMAAAOMAAAAAA== | AdUvkSceoHAAAAwMAAAAAA== | AAABa6pz9wN51APBAADH4w== | 2019-06-30 22:14:15.195000 |
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
2 rows in set (0.05 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='006c3e15917ca1640caa9ab634661872' and pid='AdUvfLERPeMAAAOMAAAAAA==' limit 1;
+----------------------------------+--------------------------+--------------------------+
| sensor_id | pid | parent_pid |
+----------------------------------+--------------------------+--------------------------+
| 006c3e15917ca1640caa9ab634661872 | AdUvfLERPeMAAAOMAAAAAA== | AdUvfLDOuCkAAAMIAAAAAA== |
+----------------------------------+--------------------------+--------------------------+
1 row in set (0.33 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='006c3e15917ca1640caa9ab634661872' and pid='AdUvfLDOuCkAAAMIAAAAAA==' limit 1;
+----------------------------------+--------------------------+--------------------------+
| sensor_id | pid | parent_pid |
+----------------------------------+--------------------------+--------------------------+
| 006c3e15917ca1640caa9ab634661872 | AdUvfLDOuCkAAAMIAAAAAA== | AdUvfLCn4awAAAJsAAAAAA== |
+----------------------------------+--------------------------+--------------------------+
1 row in set (0.37 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='006c3e15917ca1640caa9ab634661872' and pid='AdUvfLCn4awAAAJsAAAAAA==' limit 1;
+----------------------------------+--------------------------+--------------------+
| sensor_id | pid | parent_pid |
+----------------------------------+--------------------------+--------------------+
| 006c3e15917ca1640caa9ab634661872 | AdUvfLCn4awAAAJsAAAAAA== | |
+----------------------------------+--------------------------+--------------------+
1 row in set (0.27 sec)
memsql> select * from process_relations limit 2 offset 1000;
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
| sensor_id | pid | parent_pid | internal_id | event_id | generated_time |
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
| 0826174f333cd820985b6cabef6a4f7c | AdUviZ4/A00AAB1IAAAAAA== | AdUve/FNgSwAAAMsAAAAAA== | AdUviZ4/A00AAB1IAAAAAA== | AAABa6pCleecD98UAACT6Q== | 2019-06-30 21:20:19.044000 |
| 0826174f333cd820985b6cabef6a4f7c | AdUviZN5CcwAAAyEAAAAAA== | AdUve/GNUUgAAAPAAAAAAA== | AdUviZN5CcwAAAyEAAAAAA== | AAABa6pCT1ecD98UAACSkg== | 2019-06-30 21:20:00.980000 |
+----------------------------------+--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+
2 rows in set (0.02 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='0826174f333cd820985b6cabef6a4f7c' and pid='AdUve/FNgSwAAAMsAAAAAA==' limit 1;
+----------------------------------+--------------------------+--------------------------+
| sensor_id | pid | parent_pid |
+----------------------------------+--------------------------+--------------------------+
| 0826174f333cd820985b6cabef6a4f7c | AdUve/FNgSwAAAMsAAAAAA== | AdUve/Ent1cAAAKUAAAAAA== |
+----------------------------------+--------------------------+--------------------------+
1 row in set (0.13 sec)
memsql> select sensor_id, pid, parent_pid from process_relations where sensor_id='0826174f333cd820985b6cabef6a4f7c' and pid='AdUve/Ent1cAAAKUAAAAAA==' limit 1;
+----------------------------------+--------------------------+--------------------+
| sensor_id | pid | parent_pid |
+----------------------------------+--------------------------+--------------------+
| 0826174f333cd820985b6cabef6a4f7c | AdUve/Ent1cAAAKUAAAAAA== | |
+----------------------------------+--------------------------+--------------------+
1 row in set (0.09 sec)