What does Using filesort mean in MySQL?
来源:互联网 发布:php mysql支持 编辑:程序博客网 时间:2024/05/17 23:54
原文地址:https://www.percona.com/blog/2009/03/05/what-does-using-filesort-mean-in-mysql/
译文如下:
如果你来Persona面试,那我会问你:在EXPLAIN中using filesort是什么意思?你会怎样回答呢?
直到目前为止,我已经在大量的面试中问到过这个问题,这其中包括一些很聪明的面试者,然而没有一个人能给出其正确的解释。因此我认为这可能并不是一个很好的面试问题,并且现在我想给出关于这个问题的答案。从现在开始,如果还是有人不能解释这个问题,那只能说明他并没有读过我的这篇博文。
人们通常给出的答案,类似于“数据行因为太大(too big)而不能放在内存当中,只能存放在临时表当中”。然而不幸的是,事实并不是这么回事。从给出的这个答案去理解,首先,使用了临时表;其次,如果临时表太大是要将其存放在硬盘上的。但是EXPLAIN并没有给出这个意思。(如果我来面试你,我可能还会问你,你怎么理解"too big"。我可能还会问你,其它导致将临时表存放在磁盘上的原因。)
事实上,filesort本身命名是有问题的。只要一个排序不能使用索引进行排序,那么它就是filesort。它本身和文件无关。filesort应该被称为sort。而它的实现方式是:快速排序(quicksort)。
如果要排序的数据占用的内存的大小比排序缓存(sort buffer)大,那么一次排序就排其中的一部分。最后再将各个块的排序结果进行合并再输出。当然还有很多除此之外其它额外的工作要做。推荐你读一读 Sergey Petrunia’s article on How MySQL executes ORDER BY.
- What does Using filesort mean in MySQL?
- What does "size" in int(size) of MySQL mean?
- What does information_schema.TABLES.DATA_FREE mean in MySQL?
- What does (Aborted) mean in HttpWatch?
- In Javascript, what does this underscore mean?
- What does ^M character mean in Vim?
- What does “%.*s” mean in printf?
- Build a Simple Program Using Boost in(std::cin) : What does it mean?
- what does boinc mean?
- what does "ERP" mean
- What does "V"mean
- What does "Vanilla" mean ?
- mysql using filesort
- Discussion1: What does mandatory/required variable in a query mean?
- What does backend type static mean in Magento?
- What does the first letter "c" mean in "calloc"?
- what does mean "Units" in apple app sales report?
- What does the \0 symbol mean in a C string?
- mybatis 项目配置 xml文件时 报错提示(The reference to entity "useSSL" must end with the ';' delimiter.)
- Assign Cookies问题及解法
- 牛人整理分享的面试知识:操作系统、计算机网络、设计模式、Linux编程,数据结构总结
- WebService基础教程之三(通过UrlConnection调用WebService服务)
- Android studio 一些东西
- What does Using filesort mean in MySQL?
- oj557. Reverse Words in a String III
- 安卓线程池和任务:
- 动态规划练习——滑雪
- box-shadow的内外阴影
- 重定向和请求转发的区别
- oracle安全管理
- [DLLImport C# UWP] UWP use DLL compiled by VS2015 C++
- 【IMWeb训练营作业】组件间通讯