久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

mysql - 為什么使用Group By對SQL的索引性能會有很大的影響

瀏覽:167日期:2022-06-21 13:57:17

問題描述

為什么使用Group By對SQL的索引性能會有很大的影響?索引是不是能提升group by的性能?

還有一點關于SQL的疑問,為什么在使用模糊查詢的時候,%name%, 如果使用了前模糊,會使得索引沒有了效果,這個怎么理解,雖然模糊的知道可能是這樣的,但是找不到官方對此的說法。謝謝~

問題解答

回答1:

“對索引性能有很大影響”是指什么?索引的時間太久了?但這似乎又和gruop by沒什么關系。

所以我猜你的問題是不是“索引是不是能提升group by的性能”?這個問題的因果關系好想更容易理解些,那如果是這個問題的話,可能下面這段話能給你一些提示:

SQL databases use two entirely different group by algorithms. Thefirst one, the hash algorithm, aggregates the input records in atemporary hash table. Once all input records are processed, the hashtable is returned as the result. The second algorithm, the sort/groupalgorithm, first sorts the input data by the grouping key so that therows of each group follow each other in immediate succession.Afterwards, the database just needs to aggregate them. In general,both algorithms need to materialize an intermediate state, so they arenot executed in a pipelined manner. Nevertheless the sort/groupalgorithm can use an index to avoid the sort operation, thus enablinga pipelined group by.

原文出處:Indexing Group By

相關文章:
主站蜘蛛池模板: 电白县| 新巴尔虎左旗| 昌图县| 东乌珠穆沁旗| 华阴市| 栾城县| 波密县| 茌平县| 阳泉市| 治多县| 上栗县| 山丹县| 弋阳县| 雷波县| 洪泽县| 惠来县| 乌兰浩特市| 德江县| 台中县| 九江县| 江永县| 西城区| 扬中市| 荥经县| 白城市| 阜新市| 安仁县| 汉川市| 福泉市| 喜德县| 南岸区| 禄丰县| 开阳县| 毕节市| 周宁县| 稷山县| 蒙山县| 嘉鱼县| 河津市| 炎陵县| 诸暨市|