The way to divide tables is to avoid cross-table operations. Let business operations be completed in a table. If you want to cross tables, it means that the division method is unreasonable.
If there are really some business scenarios that need to span tables, consider multiple partitioning methods to exist at the same time to create copy redundancy.
Locate the specific table based on the week. To put it bluntly, it means specifying the specific table when generating the sql statement. It has nothing to do with mysql.
The problem of splicing sql statements, table naming should be regular, get the current week, splice, the first 10 hots are completed with order by and top 10 or limit 0,10 keywords
I personally don’t like to put logic into mysql, so according to your table splitting method, you can only take out the top 10 of each table from the seven tables, and then compare them in the application. In addition, I suggest that you divide the table according to the monthly level, so as to support more business needs. Your table partitioning method is more like modular table partitioning, and naturally does not support querying and sorting within a time period.
This kind of sub-table can only take the top 10 of each table, and then sort it in the code. There is a problem with this sub-table rule. If there is such a scenario, data redundancy needs to be done
The way to divide tables is to avoid cross-table operations. Let business operations be completed in a table.
If you want to cross tables, it means that the division method is unreasonable.
If there are really some business scenarios that need to span tables, consider multiple partitioning methods to exist at the same time to create copy redundancy.
Locate the specific table based on the week. To put it bluntly, it means specifying the specific table when generating the sql statement. It has nothing to do with mysql.
The problem of splicing sql statements, table naming should be regular, get the current week, splice, the first 10 hots are completed with order by and top 10 or limit 0,10 keywords
I personally don’t like to put logic into mysql, so according to your table splitting method, you can only take out the top 10 of each table from the seven tables, and then compare them in the application. In addition, I suggest that you divide the table according to the monthly level, so as to support more business needs. Your table partitioning method is more like modular table partitioning, and naturally does not support querying and sorting within a time period.
This kind of sub-table can only take the top 10 of each table, and then sort it in the code. There is a problem with this sub-table rule. If there is such a scenario, data redundancy needs to be done