Bbs design based on mysql (2 ). 3. The key to database design is the efficiency of mysql. the mysql memory is allocated rationally, especially the size of tablecache. What happens when the system suddenly loses power? Is mysql robust? Table name 3. Database Design
The key is the efficiency of mysql. allocate the mysql memory reasonably, especially the table cache
Size. What happens when the system suddenly loses power? Is mysql robust?
Table name design, with a prefix indicating the type, all in lowercase (?), For example:
The system database starts with s, for example, the user table: suser (what about sUSER ?), The details are as follows:
S: System table, suser, sclass
M: User mail table, msysop, mdrangon
W: User message Table, wsysop, wdrangon
A: Layout Index Table, alinux, acampus
B: layout document table, blinux, bcampus
C: Special classification layout table, cnewboard
I: base index table, ilinux, ilinux01, icampus, icampus04
J: Excellent article table, jlinux, jcampus,
In addition, are strings or numbers used as identifiers? For example, a sysop account
The id is 1. is the table of his email msysop or m00001? Similarly, a version called campus corresponds
If the code is 5, will the table name of this article be bcampus or b00005? It may be easy to use strings.
Check the error.
User info table: suser
Usernum int unique, // unique identifier, which can contain up to 30000 accounts. Will it be too small?
Userid char [20] primary key, // keyword of sorting, id, all lower case.
Passwd char [20], // password, which stores the encrypted ciphertext.
Realid char [20], // actual id, case-insensitive.
Username char [24], // username
Userlevel longint, // 64 permissions?
Numlogins int,
Numposts int,
Firstlogin time,
Lastlogin time,
Staytime time,/* Total stay time */
Lasthost char [32],
Email varchar [100],
Address varchar [100],
// Do I need other data? Whether to leave a certain reserved value, and then alter table
// What is the efficiency of adding new fields?
Layout classification table: sclass
Classnum int unique, // Category ID
Classid char [20], // English id of the classification: computer
Classname varchar [100], // Chinese description of classification: Computer World
Classtable char [20], // layout table corresponding to the special category
// Generally, each layout belongs to only one category. for special categories, such as the fist section,
// New layout, which can be described using special tables
Layout table: sboard
Boardnum int unique, // layout identifier (required ?)
Boardid char [20], // English name of the layout
Boardname varchar [100], // Chinese name of the layout
Boardclass char [20], // layout category
Boardsysop varchar [100], // bamboo list
Boardposts int, // Number of articles on the layout
Boardlevel int, // read and write permissions for the layout
Indextable char [20], // name of the index table corresponding to the layout: aboardid?
Texttable char [20], // The name of the article table corresponding to the layout: bboardid?
// Are the last two items necessary? can they be used as an inevitable correspondence or allowed?
// Is there more flexibility? In addition, can the case sensitivity problem of the layout be directly defaulted?
// Only start with uppercase letters,
Layout of special categories: snewboard and sstarboard
Boardid char [20], // layout id
// Is this table necessary?
Layout Index Table: acampus, alinux, afootball ......
Id int, // document sequence number, which must be adjusted manually ????
Mark char [1], // article mark, m, g, B, d ....
Title varchar [100], // Article title
Writer char [20], // author id
Posttime time, // posting time
Textnum longint, // The corresponding number ??? Not adjusted
Layout article table
Textnum longint, // Article number?
Textword text, // article content?
// Is it necessary to separate the index from the document content? In terms of efficiency, lazy flush
// Is inevitable. Delete is also marked first.
// Whether the layout text in the user is unread or not is complex, and whether a heap of tables should be created
// Can it be implemented?
// The voting function is not considered for the moment ....
Bytes. The key to database design is the efficiency of mysql. the mysql memory is allocated rationally, especially the table cache size. What happens when the system suddenly loses power? Is mysql robust? Table name...