mysql - 数据库中某个表存储大量数据,如何优化
PHP中文网
PHP中文网 2017-04-17 13:51:57
0
3
429

在做一个网盘系统,使用了一个表保存了用户的所有文件信息,当用户上传文件很多以及用户数越来越多时,如何优化(用户上传、删除时修改该表,浏览文件时只查询该表)表结构如下:

uid表示用户id,name为用户上传的文件名

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
阿神

If there are many fields, you can split the table vertically and use a fid to correspond.
If there is a lot of data, you can consider splitting the table horizontally. There are many ways to split the table, so you can consider it again

If it can improve performance, it will be simpler to use read-write separation, and the effect will be obvious

黄舟

Consider table splitting based on separation of reading and writing, for example, splitting tables by year based on upload time, splitting tables by user ID segment, or splitting tables based on your specific business

洪涛

https://segmentfault.com/q/1010000000265631

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template