我做了一个文章发布的功能。待选用的两种方案:有一个主表存放文档的主要信息,表结构如下:表main:
contentid 文档ID
typeid 所属栏目
title 标题
thumb 形象图
keywords 关键字
description 描述
url 转向
listorder 排序
status 状态
userid 录入者ID
username 录入者姓名
inputtime 录入时间
updatetime 更新时间
... 等
其中检索一般用typeid做为标准配合其他限制,比如userid、inputtime。第一种方案:直接查询main表。 如“select * from main where typeid=4 and userid>4”第二种方案:再创建一个微表,微表仅存放常用的会检索的字段。表机构如下:表tiny:
contentid 文档ID
typeid 所属栏目
userid 录入者ID
inputtime 录入时间
这样查询的时候,就查询微表,如“select * from tiny where typeid=4 and userid>4”
获得符合条件的 contentid 记为ids,
使用 select * from main where contentid in (ids) 查询主表获取信息。这两种方式哪种效果会更好些呢?这样的设计可能不可以一概而论,牵涉到表结构的设计,已经数据量的大小。我假设一种情况,
contentid、typeid、userid、inputtime 这些会在检索时候用的字段都索引了,数据量就按照很多处理,比如100W的数据。这样的话,哪种方案会好些?又或您有更好的方案,不吝赐教
解决方案 »
- alert写个弹出小窗口,怎么先进行数值的计算再弹出的alert窗口
- php程序中怎么实现 - 无刷读取数据库
- vertrigoserv安装后报如下错误
- The specified CGI application misbehaved by not returning a complete set of HTTP headers
- 如何读取字串中的每一个中文字?
- MAX用法?
- 代码0是什么错误?
- 安装Apache2问题
- 没有固定ip,把摄像机拍的现场的情况,直播到网上,怎么实现?
- curl抓取frame里面的cookie
- 点击链接后,弹出输入框,可输入信息,再进表的问题
- 在php中session可以用files, mysql, apc, eaccelerator, memcache, shmop几种方式保存,你了解哪个
昨天百度的人发了一系列关于mysql分区的帖子,你可以看下:
http://topic.csdn.net/u/20100811/17/86c0a1ce-ee05-448e-9ba1-49b293cba3aa.html
http://topic.csdn.net/u/20100811/17/ae9f2d7f-4510-417a-9090-a2ddc8049c22.html
http://topic.csdn.net/u/20100811/17/f806026e-9df7-49df-8272-6e0c948c2adc.html
http://topic.csdn.net/u/20100811/17/77a2d9ad-a8a8-4f42-834f-1c3c0dfb737e.html
http://topic.csdn.net/u/20100811/18/388d60ff-0632-4b0e-b280-edd9d7fc689f.html
http://topic.csdn.net/u/20100811/18/cfa3e3ad-8b7a-41aa-9f29-83ee6f5e779f.html希望对你有帮助。