English 中文(简体)
在其它表格中分隔更新列是否有助于优化( MySQL MyISAM 表格)?
原标题:is separating update column in other table will help in optimization(MySQL MyISAM table)?

MySQL MyISAM “Table1 ”, "% 选择 ,% 选择 ,% 更新 ,% 更新 ,0.67% 插入 语句的近似值。

有一个“ 超强” count_ clumn( int)

更新“ 超强” 的“ 超强” 计数栏

所以在其它表格中分隔“ 强” 计数栏

我还要在加入的选定发言中单独列一栏。

谢谢, 哟, 哟, 哟

问题回答

问题在于与INSERT的连接, 而不是更新本身, 但你必须拥有一大堆SELECTs。 您的问题缺乏一些细节...

COUNT在 MyISAM 表格上是真正最优化的, 如果您遇到问题, 您也许应该考虑计算估计数或内存表, 以这个数值表示 : : - 但是, MyISAM 的精确行数被存储在存储引擎上非常快, 所以您甚至可以用你的解决方案减缓 MySQL 。 “ 慢” COUNT 适用于 InnoDB 这样的引擎, 因为它们具有交易性质 。

还有一点需要考虑,即在表格本身的一列中储存一个计数是每行增加一个列,而且相当糟糕。

如果您使用触发器来完成您应该知道的 http://dev.mysql.com/doc/refman/5.0/en/faqs-trigers.html#qanda item-B-5-1:

在另一个表格中移动经常更新的单元格将会大大减少表格上的锁并加速选择。 将表格转换为 InnoDB 也可以有所帮助( 如果您没有使用全文索引, 在 MySQL 5. 5 InnoDB 中仍然不支持这些索引), 因为它使用行级锁而不是表格级别。 如果您有很多查询, 请查看 < a href=' http://www. mysqlproperationblog. com/2007/07/01/ profacting- effect- couners- with- mysql/" rel=“ no folpol" 有关执行高效计数 的文章





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

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 = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签