3. Database design
The key is the MySQL efficiency problem, the reasonable allocation of MySQL memory, especially the table cache
Size. In addition, when the system suddenly power down? is MySQL robust?
Table name design, using a prefix to indicate the type, all in lowercase (?). ), for example:
The database of the system, with S as the leading, such as the user table: Suser (suser? ), specifically as follows:
S: System table, Suser,sclass
M: User Letter form, Msysop,mdrangon
W: User Message table, Wsysop,wdrangon
A: Layout Index table, Alinux,acampus
B: Layout Article table, Blinux,bcampus
C: Special category layout table, Cnewboard
I: Index table of the essence area, ILINUX,ILINUX01,ICAMPUS,ICAMPUS04
J: Essence area Article table, Jlinux,jcampus,
Also, do you use a string or a number as an indicator? For example, an account called Sysop, whose
The ID is 1, is the table of his letter msysop or m00001? Similarly, a version called campus, corresponding to the
The code is 5, then the table name of this version of the article is Bcampus or b00005 it? It might be easier to use a string
Understand, check the wrong.
User Information table: suser
usernum int unique,//Unique identifier, up to 30,000 accounts, will it be too little?
UserID CHAR[20] PRIMARY key,//Sort the keyword, id, all lowercase.
passwd char[20],//password, store encrypted ciphertext.
RealID char[20],//Real ID, mixed case.
Username char[24],//user's mud weigh
Userlevel Longint,//64 kinds of permissions?
Numlogins int,
numposts int,
Firstlogin time,
Lastlogin time,
Staytime time,/* Total stay * *
Lasthost Char[32],
Email varchar[100],
Address varchar[100],
Do you need any more data? If you need to leave a certain retention value, ALTER TABLE to
What is the efficiency of adding new fields?
Layout Classification table: Sclass
classnum int unique,//category ID
ClassID char[20],//category in English Id:computer
ClassName varchar[100],//Description: Computer World
Classtable char[20],//special classification of the corresponding layout table
In general, each layout belongs to only one category, for special categories, such as fist sections,
A new layout that can be described with a special table
Layout table: Sboard
boardnum int unique,//layout identification (required?) )
Boardid char[20],//English name of the layout
Boardname varchar[100],//The Chinese name of the layout
Boardclass char[20],//Layout category
Boardsysop varchar[100],//Bamboo List
boardposts int,//page number of articles
Boardlevel int,//page read and Write permissions
Indextable char[20],//Layout corresponding index Table name: Aboardid?
Texttable char[20],//Layout corresponding article table name: Bboardid?
The last two items are not necessary, whether they can be used as an inevitable correspondence, or allow
Is there more flexibility? In addition, the size of the layout of the problem can be directly default
Capitalize only the beginning of the letter,
Special Category layout table: Snewboard, Sstarboard
Boardid char[20],//Layout ID
Is such a table necessary?
Layout Index Table: Acampus,alinux,afootball ...
ID int,//article ordinal, to manually adjust????
Mark Char[1],//article Mark, m,g,b,d ....
Title varchar[100],//article title
Writer Char[20],//article author ID
Posttime time,//Published
Textnum longint,//corresponding number??? Do not adjust
Layout Article table
Textnum Longint,//article ID?
Textword text,//article content?
Is it necessary to separate the index from the article content? In terms of efficiency, besides lazy flush
is inevitable. The deletion is marked first.
Whether the layout article in the user is not readable data is more complicated, should build a pile of tables
To achieve it?
Voting function is temporarily not considered ....
The above describes the bbs.txtnovel.com based on the MySQL BBS design (ii), including the bbs.txtnovel.com aspects of the content, I hope that the PHP tutorial interested in a friend helpful.