BBS Design Based on MySQL (2)

Source: Internet
Author: User

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 Article 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
Code5. Is the table name of this article 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.

// does the layout document in the user have a complex amount of unread data? Should I create another pile of tables?
// can this be achieved?
// The voting function is not considered for the moment ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.