English 中文(简体)
哪些是非银的表象储存大量伐木数据?
原标题:What s a good DB schema to store high volume logging data?

I m 在繁忙的网站上添加“活动记录”,该网站应显示用户与他相关的最后一项国家行动,并能够进入一个专用网页,查看所有行动,搜寻行动等。

使用的银是MySQL,我不知道如何储存该记录——我先是用一枚Mysam表格进行FFLLT地下室搜索,避免就每项行动提出额外的询问: (1) 表格中插入2个,每个表上都更新了装甲运兵车的藏匿点,因此,下页要求不要使用我的q。 Cache有一生的标志,如果它消失,则用户提出的第一份AJAX申请就会产生这一结果。

我为每个用户安排了最后3次活动,这样,当发生新事件时,我 gr弃目前的切身,在新事件的开端增加,删除最老的事件,因此,藏匿者中始终有3人。 该网站的每一页都有一个小的盒子显示这些盒子。

Is this a proper setup? How would you recommend implementing this sort of feature?

我的图谋是:

CREATE DATABASE `audit`;

CREATE TABLE `event` (
`eventid` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`userid` INT UNSIGNED NOT NULL ,
`createdat` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
`message` VARCHAR( 255 ) NOT NULL ,
`comment` TEXT NOT NULL
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER DATABASE `audit` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

ALTER TABLE `audit`.`event` ADD FULLTEXT `search` (
    `message` ( 255 ) ,
    `comment` ( 255 )
);
最佳回答

根据您的图表,我猜测,(搁置一边),你将每秒插入许多记录,并按“<代码>的字句,从用户_id = 的情况中得出相当不准确的问询。 定购单——日期:,可能还有一项计算战略(在查询结束时要求“限制×”以显示用户的历史。

You probably also want to find all users affected by a particular type of event - though more likely in an off-line process (e.g. a nightly mail to all users who have updated their password"; that might require a query along the lines of select user_id from event where message like password_updated .

是否有人想搜索评论的正文?

页: 1 • 《MySQL手册》:为插入“进行校对;如果你不需要寻找自由文本的“comment”,我就将索引从中删除;我也考虑定期编制“message”表索引。

引入“年龄-类型”概念也是有益的,这样,你就能够引入关系一致性(而不是依靠你的代码正确表述“字号”......。 例如,你可能有一个“发明——类型”表,与你的活动表有外国关键关系。

至于缝.,我gues的用户只能经常访问其历史网页。 当他们访问该网站时,在他们可能访问自己的历史(如果我理解你的设计)之后,立即限制你解决办法的可变性,以衡量你们有多少历史记录可以适应你们的奇迹;由于历史表会迅速增长,这很快就会成为一个重要因素。

For data like this, which moves quickly and is rarely visited, caching may not be the right solution.

问题回答

This is how Prestashop does it: CREATE TABLE IF NOT EXISTS `ps_log` ( `id_log` int(10) unsigned NOT NULL AUTO_INCREMENT, `severity` tinyint(1) NOT NULL, `error_code` int(11) DEFAULT NULL, `message` text NOT NULL, `object_type` varchar(32) DEFAULT NULL, `object_id` int(10) unsigned DEFAULT NULL, `id_employee` int(10) unsigned DEFAULT NULL, `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, PRIMARY KEY (`id_log`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;

我的建议是使用一个较少储存系统的图象,在大量伐木数据方面做得更好。

Try to consider

  • Redis
  • MongoDB
  • Riak

或任何其他<条码> 系统





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签