...
[1] https://mariadb.com/kb/en/library/table-pullout-optimization/
[2] https://dev.mysql.com/doc/refman/8.0/en/subquery-optimization-with-exists.html
...
Partitions could be calculated not only on the server side, but on clients as well. This way thin clients could be able to send requests directly to affected nodes, reducing latency. To achieve this we first define serializable partition tree model:
Code Block | ||
---|---|---|
| ||
interface PartitionNode {
Collection<Integer> apply(Object[] args);
}
class PartitionGroup implements PartitionNode {
Collection<Object> parts; // Concrete partitions, arguments or both.
}
class PartitionExpression implements PartitionNode {
PartitionNode left;
PartitioNode right;
} |
Partition tree is enriched with {{AffinityTopologyVersion}} it was built on, and affinity function descriptor. Descriptor can only be defined for well-known affinity functions, such as {{RendezvousAffinityFunction}}, and defines the logic on how to convert an object to partition.
Code Block | ||
---|---|---|
| ||
class PartitionInfo {
PartitionNode tree;
AffintiyTopologyVersion affTopVer;
AffinityFunctionDecriptor affFunc;
} |
When client executes request for the first time, the following sequence of actions happen:
Client saves partition tree and re-use it for further requests as follows:
Jira | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|