Home >Backend Development >PHP Tutorial >How to sort millions of data in php+mysql_PHP tutorial

How to sort millions of data in php+mysql_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:26:591095browse

How to sort millions of data in php+mysql?

 php+mysql million-level data paging. Because it involves joint queries with multiple tables and multiple conditions. Can anyone help optimize the following query statement?

 if(empty($wheresql)){

 $wheresql="where aid>=(SELECT aid FROM `tj_logs` LIMIT $sqlfirst,1) limit $shownu";

 }else{

 $wheresql.=" and aid>=(SELECT aid FROM `tj_logs` LIMIT $sqlfirst,1) limit $shownu";

 }

 $query=mysql_query("SELECT DISTINCT A.*,B.url,C.username FROM `tj_logs` A LEFT JOIN `tj_domain` B ON A.wid=B.wid LEFT JOIN `tj_members` C ON A. uid=C.uid $wheresql");

 ------Solution--------------------

In a sense, you should adopt redundant design to exchange redundancy for efficiency. This is the so-called anti-paradigm design

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/820424.htmlTechArticleHow to sort million-level data with php+mysql? Paging of million-level data with php+mysql. Because it involves joint queries with multiple tables and multiple conditions. Can anyone help optimize the following query statement? if(empty($wheresql)){ $wher...
Statement:
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