Mysql infinite horizontal table after how to query part of the data and paging display? (php)

upload and display items of pictures

album table album (field: album_id userid title...)
picture table photo (field: photo_id albumid path...)

A photo album contains multiple pictures

more pictures are uploaded in one day. Consider horizontal sub-table and infinite sub-table, 10 tables at a time. After the data reaches a certain amount, continue to sub-table
the album table is divided according to userid, and userid takes module 10, which is called album_0 album_1. After the album_9
data reaches a certain amount, continue to sub-table userid module 20, so that is alnum_10 album_11. Album_19
and so on, you can divide the table infinitely
photo table is similar to albumid table, it is also infinite table

the question now is how to query a user"s photo album after infinite sub-table, such as userid=123456 "s photo album, his photo album may be in different data tables, how to query it and display it in pages?
Loop query album_0 album_1... Album_9 alnum_10 album_11... Album_19...
is too inefficient to estimate

May.31,2022

your sub-table principle is very wrong, after the sub-table, your user id is never in the same table. This leads to cross-table queries if your data increases. It is even more difficult for paging. For your data archiving, it is very difficult to handle. It is recommended to set the base of your sub-meter. If 10 is too small, it is recommended to start at 100. In this way, the number of data limits can be greater. Try not to use infinite sub-tables as much as possible.


you have split according to the user ID multi-photo albums. If calculated according to the user ID module, how can the photo albums of the same user be saved in different tables?

Menu