The structure of the order table is the same. It is recommended to process it at the database layer. SQL statement union query, and then perform order by and limit processing. The terminal directly gets the processed data; the code solution will consume memory
The sub-library and sub-table itself is a double-edged sword. If the single volume is 10 or millions, it is not recommended to divide it now. Regarding the query conditions you mentioned, if the demand is quite large and the query time is quite large, I suggest building a separate database and summarizing the data from the previous sub-databases (only the data needed for querying is summarized). Just read the bin log and write ETL. In addition to solving your needs, another advantage is that it is very convenient to analyze statistics. Or you can directly use Alibaba’s open source middleware to isolate the database and business programs
If you want to divide the database and tables according to the user dimension, you need to divide the database and tables again according to the order dimension, so there will be data redundancy
The structure of the order table is the same. It is recommended to process it at the database layer. SQL statement union query, and then perform order by and limit processing. The terminal directly gets the processed data; the code solution will consume memory
The sub-library and sub-table itself is a double-edged sword. If the single volume is 10 or millions, it is not recommended to divide it now.
Regarding the query conditions you mentioned, if the demand is quite large and the query time is quite large, I suggest building a separate database and summarizing the data from the previous sub-databases (only the data needed for querying is summarized). Just read the bin log and write ETL. In addition to solving your needs, another advantage is that it is very convenient to analyze statistics.
Or you can directly use Alibaba’s open source middleware to isolate the database and business programs
If you want to divide the database and tables according to the user dimension, you need to divide the database and tables again according to the order dimension, so there will be data redundancy