Visual Rules Solution rule engine data query <2> - use memory table to query data

A method of manipulating data using a memory table.
1. Create two tables, department table and employee table, and directly import the data in the database table into the memory table.
1.1 Create a memory table.





1.2 Add database connection.






1.3 Fill in database information



1.4 Add database table







1.5 Write rules to import data into memory table.



1.6 The data is imported successfully.








2. Integrate two memory tables and extract data into the total table.
2.1 Create a new result table




2.1 Add a rule set to traverse the department table.





2.2 Traverse the employee table, and merge the data of the department table and the employee table into the result table.



Advantages and disadvantages of the two optimization methods.
It can be seen from the two methods and steps that the first method requires a large number of database queries. If there is a small amount of data, there is basically no problem, but if the amount of data is large, it will cause data query consumption. When the situation is very large, the work efficiency is reduced. And a large number of data queries will cause a large load on the machine.
In the second case, although each table must correspond to a memory table, and each table may have to import data at the beginning, it is well organized and easy to manage data, and because all the data at the beginning have been removed from the database. Imported into the memory table, so only need to operate the memory table, no matter the amount of data, there will not be a large number of database operations, and it takes less time, and the work efficiency is high.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326814785&siteId=291194637