Home > php教程 > php手册 > body text

php+mysql百万级数据怎么排序

WBOY
Release: 2016-06-13 09:32:44
Original
1012 people have browsed it

   php+mysql百万级数据如何排序?

  php+mysql百万级数据分页。因涉及多表多条件联合查询。谁能帮忙优化下面的查询语句。

  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");

  ------解决方案--------------------

  某种意义上说,你应该采取冗余设计,以冗余换效率,这就是所谓的反范式设计

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!