In the last issue, we introduced the first implementation method of Er table, and the second method actually does not need to configure child_ Table can also implement Er table.
As shown in the figure, there are six tables tablea-f. For these tables, I set up split columns, distributed nodes and split algorithm. If we divide them into three groups, we can see that when the group number of the last column of the table is 1, and their distribution nodes and splitting algorithm are identical, these three tables can actually be er for each other. Because the split column will be used as an on condition when joining in the future. However, as long as the rule distribution is the same, they can be er for each other. In the other several tables, one is that the algorithm is the same, but the distributed nodes are reverse; the other is that the algorithm is not the same. This can not be used as Er table Association, so the configuration is more flexible, and there is no need to configure child_ Table, but there are some limitations. Let’s look at such a configuration.
In addition to the table name, the two tables are basically the same, and are ER related to each other. Next, take a look at the demo.
First look at the data in the table below, and then look at the result of join. The result is correct. Let’s take a look at the explain query plan again, and there are also four lines of results. The first two lines indicate that the whole join is sent to MySQL, the third line represents merge, and the fourth line shuffles_ Field is forwarding, which is now familiar to us. Now I’ll change the association, and it will return to our normal process. Collect the data, then do middleware, and then do cross database query. When you don’t know how to handle SQL in dble, you can explain. For example, your expectation is to use the ER table or the global table, but do you actually use it? It can be judged by appending general log to MySQL. Of course, it is convenient to judge through dble query plan. He will show a result of how and where SQL is distributed. This is another way to implement the ER table. In addition to our ER table and global table, dble also has some other functions. For example, we mentioned the associated subquery. Some logic can be distributed to MySQL nodes as a whole, but the dble syntax does not support it. We will introduce how to do it next time. OK, let’s introduce it here.
In order to facilitate reading, some spoken words are optimized without affecting learning. The manuscript and the video will be consistent as far as possible.