久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <tfoot id='bxJTg'></tfoot>
          <bdo id='bxJTg'></bdo><ul id='bxJTg'></ul>

        <small id='bxJTg'></small><noframes id='bxJTg'>

        <legend id='bxJTg'><style id='bxJTg'><dir id='bxJTg'><q id='bxJTg'></q></dir></style></legend>
        <i id='bxJTg'><tr id='bxJTg'><dt id='bxJTg'><q id='bxJTg'><span id='bxJTg'><b id='bxJTg'><form id='bxJTg'><ins id='bxJTg'></ins><ul id='bxJTg'></ul><sub id='bxJTg'></sub></form><legend id='bxJTg'></legend><bdo id='bxJTg'><pre id='bxJTg'><center id='bxJTg'></center></pre></bdo></b><th id='bxJTg'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='bxJTg'><tfoot id='bxJTg'></tfoot><dl id='bxJTg'><fieldset id='bxJTg'></fieldset></dl></div>

        為什么 MYSQL 較高的 LIMIT 偏移量會減慢查詢速度

        Why does MYSQL higher LIMIT offset slow the query down?(為什么 MYSQL 較高的 LIMIT 偏移量會減慢查詢速度?)
      1. <legend id='pJRE5'><style id='pJRE5'><dir id='pJRE5'><q id='pJRE5'></q></dir></style></legend>

            <bdo id='pJRE5'></bdo><ul id='pJRE5'></ul>

                <i id='pJRE5'><tr id='pJRE5'><dt id='pJRE5'><q id='pJRE5'><span id='pJRE5'><b id='pJRE5'><form id='pJRE5'><ins id='pJRE5'></ins><ul id='pJRE5'></ul><sub id='pJRE5'></sub></form><legend id='pJRE5'></legend><bdo id='pJRE5'><pre id='pJRE5'><center id='pJRE5'></center></pre></bdo></b><th id='pJRE5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='pJRE5'><tfoot id='pJRE5'></tfoot><dl id='pJRE5'><fieldset id='pJRE5'></fieldset></dl></div>
                    <tbody id='pJRE5'></tbody>
                1. <tfoot id='pJRE5'></tfoot>

                  <small id='pJRE5'></small><noframes id='pJRE5'>

                  本文介紹了為什么 MYSQL 較高的 LIMIT 偏移量會減慢查詢速度?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  簡而言之場景:一個包含超過 1600 萬條記錄 [2GB 大小] 的表.當使用 ORDER BY *primary_key*

                  Scenario in short: A table with more than 16 million records [2GB in size]. The higher LIMIT offset with SELECT, the slower the query becomes, when using ORDER BY *primary_key*

                  所以

                  SELECT * FROM large ORDER BY `id`  LIMIT 0, 30 
                  

                  遠遠少于

                  SELECT * FROM large ORDER BY `id` LIMIT 10000, 30 
                  

                  那只訂購了 30 條記錄,無論如何都是一樣的.所以這不是來自 ORDER BY 的開銷.
                  現在獲取最新的 30 行大約需要 180 秒.如何優化這個簡單的查詢?

                  That only orders 30 records and same eitherway. So it's not the overhead from ORDER BY.
                  Now when fetching the latest 30 rows it takes around 180 seconds. How can I optimize that simple query?

                  推薦答案

                  較高的偏移量會使查詢變慢是正常的,因為查詢需要計算第一個 OFFSET + LIMIT 記錄(并取只有 LIMIT 個).此值越高,查詢運行的時間越長.

                  It's normal that higher offsets slow the query down, since the query needs to count off the first OFFSET + LIMIT records (and take only LIMIT of them). The higher is this value, the longer the query runs.

                  查詢不能直接轉到OFFSET,因為首先,記錄的長度可能不同,其次,刪除的記錄可能存在間隙.它需要檢查和統計途中的每條記錄.

                  The query cannot go right to OFFSET because, first, the records can be of different length, and, second, there can be gaps from deleted records. It needs to check and count each record on its way.

                  假設 id 是 MyISAM 表的主鍵,或 InnoDB 表上唯一的非主鍵字段,您可以使用以下技巧加快速度:

                  Assuming that id is the primary key of a MyISAM table, or a unique non-primary key field on an InnoDB table, you can speed it up by using this trick:

                  SELECT  t.* 
                  FROM    (
                          SELECT  id
                          FROM    mytable
                          ORDER BY
                                  id
                          LIMIT 10000, 30
                          ) q
                  JOIN    mytable t
                  ON      t.id = q.id
                  

                  請看這篇文章:

                  • MySQL ORDERBY/LIMIT 性能:延遲行查找

                  這篇關于為什么 MYSQL 較高的 LIMIT 偏移量會減慢查詢速度?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)
                    • <bdo id='a776e'></bdo><ul id='a776e'></ul>
                    • <small id='a776e'></small><noframes id='a776e'>

                        <i id='a776e'><tr id='a776e'><dt id='a776e'><q id='a776e'><span id='a776e'><b id='a776e'><form id='a776e'><ins id='a776e'></ins><ul id='a776e'></ul><sub id='a776e'></sub></form><legend id='a776e'></legend><bdo id='a776e'><pre id='a776e'><center id='a776e'></center></pre></bdo></b><th id='a776e'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='a776e'><tfoot id='a776e'></tfoot><dl id='a776e'><fieldset id='a776e'></fieldset></dl></div>

                              <tbody id='a776e'></tbody>
                            <tfoot id='a776e'></tfoot>
                            <legend id='a776e'><style id='a776e'><dir id='a776e'><q id='a776e'></q></dir></style></legend>
                            主站蜘蛛池模板: 91精品福利 | 青娱乐自拍| 精品欧美一区二区精品久久久 | 国产亚洲精品美女久久久久久久久久 | 精品国产乱码久久久久久闺蜜 | av毛片在线播放 | 波多野结衣中文视频 | 日韩精品在线看 | 在线视频 亚洲 | 一区二区三区精品在线视频 | 四虎影院在线免费观看 | 欧美一区二区三 | 国产精品久久国产精品久久 | av中文网 | 一区二区三区四区在线视频 | 91xh98hx 在线 国产 | 久久新| 中文字幕一区二区三区四区五区 | 日本亚洲一区 | 欧美成人a∨高清免费观看 老司机午夜性大片 | 中文字幕一区二区不卡 | 欧美一级视频在线观看 | 国产午夜精品一区二区三区在线观看 | 男人天堂久久 | 欧美日韩成人影院 | 久久99国产精品 | 欧美区在线| 日韩国产一区二区三区 | 欧美福利一区 | 毛片在线免费 | 久久成人精品视频 | 成人一区二区视频 | 欧美一级片黄色 | 国产成人99久久亚洲综合精品 | 久久一区二区三区四区五区 | 男女视频在线免费观看 | 亚洲欧美日韩在线不卡 | 久久久久久一区 | 日韩视频在线观看中文字幕 | 亚洲天堂av一区 | 99re6热在线精品视频播放 |