Home php教程 php手册 基于mysql的bbs设计二

基于mysql的bbs设计二

Jun 13, 2016 am 10:25 AM
bbs mysql two The essential Memory distribute Reasonable based on efficiency database of design still question

3。数据库设计
关键还是mysql的效率问题,合理分配mysql的内存,特别是table cache的
大小。另外,当系统突然掉电呢?mysql是否robust?
table的名字设计,采用一位前缀表明类型,全部用小写表示(?),例如:
系统的数据库,以s为前导,如用户表:suser(sUSER 呢?),具体如下:
s :系统表,suser,sclass
m :用户信件表,msysop,mdrangon
w :用户消息表,wsysop,wdrangon
a :版面索引表,alinux,acampus
b :版面文章表,blinux,bcampus
c :特殊分类版面表,cnewboard
i :精华区索引表,ilinux,ilinux01,icampus,icampus04
j :精华区文章表,jlinux,jcampus,

另外,是使用字串还是数字作为标识呢?例如,一个叫sysop的帐号,其
id是1,他的信的表是msysop还是m00001呢?同样,一个叫campus的版,对应的
代码是5,则这个版的文章的表名是bcampus还是b00005呢?可能用字串会容易
理解,查错吧。

用户信息表:suser
usernum int unique, // 唯一标识符,最多30000个帐号,会不会太少了?
userid char[20] primary key, // 排序的关键字,id,全小写。
passwd char[20], // 密码,存放加密后的密文。
realid char[20], // 实际id,大小写混合。
username char[24], // 用户的泥称
userlevel longint, // 64种权限?
numlogins int,
numposts int,
firstlogin time,
lastlogin time,


staytime time, /* 总共停留时间 */
lasthost char[32],
email varchar[100],
address varchar[100],
// 还需要其他数据吗?是否需要留出一定的保留值,以后alter table来
// 增加新的字段时,效率如何?

版面分类表:sclass
classnum int unique, // 分类标识
classid char[20], // 分类的英文id:computer
classname varchar[100],// 分类的中文描述:电脑世界
classtable char[20], // 特殊分类对应的版面表
// 一般来说,每个版面只属于一个分类,对于特殊分类,例如拳头版块,
// 新版面,可以用专门的表来描述

版面表:sboard
boardnum int unique, // 版面的标识(需要吗?)
boardid char[20], // 版面的英文名
boardname varchar[100], // 版面的中文名
boardclass char[20], // 版面所属分类
boardsysop varchar[100], // 斑竹名单
boardposts int, // 版面的文章数
boardlevel int, // 版面的读写权限
indextable char[20], // 版面对应的索引表的名称:aboardid?
texttable char[20], // 版面对应的文章表名称: bboardid?
// 最后两项有没有必要出现,是否可以作为必然对应关系,还是允许
// 出现更大的灵活性?另外版面的大小写问题是否可以直接默认
// 只开头字母大写,

特殊分类版面表:snewboard, sstarboard
boardid char[20], // 版面的id
// 这样的表有必要吗?

版面索引表:acampus,alinux,afootball。。。。。。
id int, // 文章序数,要手动调整????
mark char[1], // 文章标记,m,g,b,d。。。。
title varchar[100], // 文章标题
writer char[20], // 文章作者id
posttime time, // 发表时间
textnum longint, // 对应的编号???不调整

版面文章表
textnum longint, // 文章编号?
textword text, // 文章内容?
// 有必要将索引和文章内容分开吗?从效率上看,况且lazy flush
// 是必然的。删除也是先做个标记。

// 用户中的版面文章是否未读的数据比较繁,是否应该再建一堆的表
// 才能实现呢?
// 投票功能暂不考虑。。。。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

How to start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Solve database connection problem: a practical case of using minii/db library Solve database connection problem: a practical case of using minii/db library Apr 18, 2025 am 07:09 AM

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

See all articles