php排序比mysql的"order by"更好吗? [英] is php sort better than mysql "order by"?

查看:59
本文介绍了php排序比mysql的"order by"更好吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,就性能而言,考虑在具有非常多(> 1.000.000)记录的表上选择mysql,是使用sql"order by"排序结果还是使用Query查询后排序结果更好经典程序排序算法...有人有什么建议吗?

I was wondering if, in terms of performance and considering a mysql select on a table with very very very many (> 1.000.000) records, is better sorting results with sql "order by" or sorting results after the query with classical programming sort algorithm ... someone has any suggestion?

坦克

推荐答案

您正在将一个系统与以优化的C语言实现的方法进行比较,该方法旨在精确地完成此任务,并与另一个将以解释性脚本语言实现的方法进行比较

You're comparing a system with methods implemented in optimized C, meant to do exactly this task, with another that you are going to implement in an interpreted scripting language.

基本上,用C编写的任何东西都将比用PHP编写的等效函数快10到100倍.

Basically, anything written in C is going to be a lot faster than an equivalent function written in PHP, by a factor of 10 to 100.

如前所述,毫无疑问,正确配置数据库并让其完成工作要高效得多.

As already noted, there's no question at all that it is far more efficient to configure your DB properly and let it do the work.

这篇关于php排序比mysql的"order by"更好吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆