I'm going to write a novel website. I'd like to give some ideas to the bosses. If the database is designed in this way, is the data stored in mysql or file txt or xml? how can the design performance be better?

novel website, high-performance database design, using PHP + Mysql + Redis,
has seen the forum, someone said that the novel saved txt file or xml format, mysql save txt file address (paging how to do it) , would like to ask the bosses, there are no ideas, or suggestions, how to improve performance?

Jan.19,2022

pagination can be implemented in MySQL

MySQL only stores the title of the novel and the path of the file. If someone wants to read the novel, find the path from MySQL, read the file, and save it in the Redis cache

.

give a table design idea

novel list

< table > < thead > < tr > < th > Field name < / th > < th > data type < / th > < th > size < / th > < th > description < / th > < / tr > < / thead > < tbody > < tr > < td > id < / td > < td > int < / td > < td > 11 < / td > < td > Fiction table primary key < / td > < / tr > < tr > < td > title < / td > < td > varchar < / td > < td > 128 < / td > < td > novel title < / td > < / tr > < tr > < td > desc < / td > < td > varchar < / td > < td > 255 < / td > < td > introduction < / td > < / tr > < tr > < td > author < / td > < td > varchar < / td > < td > 16 < / td > < td > author < / td > < / tr > < tr > < td > noveltype < / td > < td > varchar < / td > < td > 16 < / td > < td > novel type < / td > < / tr > < tr > < td > tags < / td > < td > varchar < / td > < td > 256 < / td > < td > novel tag < / td > < / tr > < / tbody > < / table >

chapter table

< table > < thead > < tr > < th > Field name < / th > < th > data type < / th > < th > size < / th > < th > description < / th > < / tr > < / thead > < tbody > < tr > < td > id < / td > < td > int < / td > < td > 11 < / td > < td > Primary key < / td > < / tr > < tr > < td > title < / td > < td > varchar < / td > < td > 256 < / td > < td > chapter title < / td > < / tr > < tr > < td > novel_id < / td > < td > int < / td > < td > 11 < / td > < td > novel ID (which novel does it belong to) < / td > < / tr > < tr > < td > file_path < / td > < td > varchar < / td > < td > 1024 < / td > < td > article path < / td > < / tr > < tr > < td > is_delete < / td > < td > tinyint < / td > < td > 3 < / td > < td > Delete identity < / td > < / tr > < tr > < td > words < / td > < td > int < / td > < td > 11 < / td > < td > number of words < / td > < / tr > < tr > < td > ctime < / td > < td > timestamp < / td > < td >-< / td > < td > creation time < / td > < / tr > < tr > < td > mtime < / td > < td > timestamp < / td > < td >-< / td > < td > modification time < / td > < / tr > < / tbody > < / table >

use MySQL to realize random pagination, and tens of millions of data will be fine if the machine is good

personal suggestion:
do not use files to implement. If there are too many files, there will be trouble later, and performance, data consistency, and security cannot be guaranteed. If you really want to use files to implement, it is recommended to use a secure distributed file system to store
novels. It is not a big file at all to use MySQL + Redis. Just add a list of novel contents, and then make some changes to the chapter table. The complete design is as follows

novel list

< table > < thead > < tr > < th > Field name < / th > < th > data type < / th > < th > size < / th > < th > description < / th > < / tr > < / thead > < tbody > < tr > < td > id < / td > < td > int < / td > < td > 11 < / td > < td > Fiction table primary key < / td > < / tr > < tr > < td > title < / td > < td > varchar < / td > < td > 128 < / td > < td > novel title < / td > < / tr > < tr > < td > desc < / td > < td > varchar < / td > < td > 255 < / td > < td > introduction < / td > < / tr > < tr > < td > author < / td > < td > varchar < / td > < td > 16 < / td > < td > author < / td > < / tr > < tr > < td > noveltype < / td > < td > varchar < / td > < td > 16 < / td > < td > novel type < / td > < / tr > < tr > < td > tags < / td > < td > varchar < / td > < td > 256 < / td > < td > novel tag < / td > < / tr > < / tbody > < / table >

chapter table

< table > < thead > < tr > < th > Field name < / th > < th > data type < / th > < th > size < / th > < th > description < / th > < / tr > < / thead > < tbody > < tr > < td > id < / td > < td > int < / td > < td > 11 < / td > < td > Primary key < / td > < / tr > < tr > < td > title < / td > < td > varchar < / td > < td > 256 < / td > < td > chapter title < / td > < / tr > < tr > < td > novel_id < / td > < td > int < / td > < td > 11 < / td > < td > novel ID (which novel does it belong to) < / td > < / tr > < tr > < td > content_id < / td > < td > varchar < / td > < td > 1024 < / td > < td > article content id, corresponding content table id < / td > < / tr > < tr > < td > is_delete < / td > < td > tinyint < / td > < td > 3 < / td > < td > Delete identity < / td > < / tr > < tr > < td > words < / td > < td > int < / td > < td > 11 < / td > < td > number of words < / td > < / tr > < tr > < td > ctime < / td > < td > timestamp < / td > < td >-< / td > < td > creation time < / td > < / tr > < tr > < td > mtime < / td > < td > timestamp < / td > < td >-< / td > < td > modification time < / td > < / tr > < / tbody > < / table >

content table

< table > < thead > < tr > < th > Field name < / th > < th > data type < / th > < th > size < / th > < th > description < / th > < / tr > < / thead > < tbody > < tr > < td > id < / td > < td > int < / td > < td > 11 < / td > < td > Primary key < / td > < / tr > < tr > < td > content < / td > < td > text < / td > < td >-< / td > < td > Section content < / td > < / tr > < / tbody > < / table >

Why is the content of the novel not in the chapter table?


I also want to set up a novel website, can I refer to the database design of the landlord

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37eea-34482.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37eea-34482.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?