Author:flymorn Source: Easy to floatcategories:php Programming Posttime:2011-1-14 15:35:07Text:
Recently, due to the need to study the MySQL random extraction implementation method. For example, to randomly extract a
Author:flymorn Source: Easy to floatcategories:php Programming Posttime:2011-1-14 15:35:07Text:
Recently, due to the need to study the MySQL random extraction implementation method. For example, to randomly extract a
Original address: http://www.phpchina.com /? Action-viewnews-itemid-33727
This topic explains in detail
MySQL
Order By
Rand ()
Efficiency The optimization solution and the optimization process are provided. It is a rare article about MySQL
The RAND () Optimization Method for MySQL optimization and the rand Method for mysql Optimization
As we all know, in MySQL, if order by rand () is used directly, the efficiency is very poor because it will be executed multiple times. In fact, this
The general wording is: SELECT * from Content order by RAND () LIMIT 1."Drift Easy Note: 30,000 records query cost 0.3745 seconds (same below); from the MySQL slow query log, see" Order by RAND () "Full table scanned 2 times! 】
Then I looked up the
MySQL random query: MySQL Order by Rand () efficiency problem has always been a developer's frequently asked questions, we are not DBA, not so cow B, can only slowly study, recently due to project issues, need to probably study the MySQL random
Order by rand (), orderbyrand
The random extraction Implementation Method of MYSQL needs to be roughly studied. For example, to randomly extract a record FROM the tablename table, the general syntax is: SELECT * FROM tablename order by rand () LIMIT
Recently, because of the need to study the MySQL random extraction implementation method. For example, to randomly extract a record from the TableName table, the general wording would be: SELECT * from TableName ORDER by RAND () LIMIT 1.
But then I
Recently, we have studied the implementation of MYSQL random extraction. For example, to randomly extract a record FROM the tablename table, the general syntax is: SELECT * FROM tablename order by rand () LIMIT 1.However, I checked the MYSQL
Recently because of the need to study the MySQL random extraction implementation method. For example, to randomly extract a record from the TableName table, the general wording would be: SELECT * from TableName ORDER by RAND () LIMIT 1. However, I
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.