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

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

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

        <bdo id='g2Msw'></bdo><ul id='g2Msw'></ul>
      1. 如何向 MySQL 表添加索引?

        How do I add indexes to MySQL tables?(如何向 MySQL 表添加索引?)

            1. <legend id='aXNuA'><style id='aXNuA'><dir id='aXNuA'><q id='aXNuA'></q></dir></style></legend>
            2. <small id='aXNuA'></small><noframes id='aXNuA'>

                • <bdo id='aXNuA'></bdo><ul id='aXNuA'></ul>
                    <tbody id='aXNuA'></tbody>
                • <tfoot id='aXNuA'></tfoot>
                  <i id='aXNuA'><tr id='aXNuA'><dt id='aXNuA'><q id='aXNuA'><span id='aXNuA'><b id='aXNuA'><form id='aXNuA'><ins id='aXNuA'></ins><ul id='aXNuA'></ul><sub id='aXNuA'></sub></form><legend id='aXNuA'></legend><bdo id='aXNuA'><pre id='aXNuA'><center id='aXNuA'></center></pre></bdo></b><th id='aXNuA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aXNuA'><tfoot id='aXNuA'></tfoot><dl id='aXNuA'><fieldset id='aXNuA'></fieldset></dl></div>
                  本文介紹了如何向 MySQL 表添加索引?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個非常大的 MySQL 表,其中包含大約 150,000 行數據.目前,當我嘗試運行

                  I've got a very large MySQL table with about 150,000 rows of data. Currently, when I try and run

                  SELECT * FROM table WHERE id = '1';
                  

                  代碼運行良好,因為 ID 字段是主索引.但是,對于項目的最新發展,我必須通過另一個字段搜索數據庫.例如:

                  the code runs fine as the ID field is the primary index. However, for a recent development in the project, I have to search the database by another field. For example:

                  SELECT * FROM table WHERE product_id = '1';
                  

                  此字段以前未編入索引;但是,我添加了一個,因此 mysql 現在對該字段進行索引,但是當我嘗試運行上述查詢時,它運行速度非常慢.EXPLAIN 查詢顯示,當我已經添加了 product_id 字段時,沒有索引,因此查詢需要 20 分鐘到 30 分鐘的任何時間來返回單行.

                  This field was not previously indexed; however, I've added one, so mysql now indexes the field, but when I try to run the above query, it runs very slowly. An EXPLAIN query reveals that there is no index for the product_id field when I've already added one, and as a result the query takes any where from 20 minutes to 30 minutes to return a single row.

                  我的完整解釋結果是:

                  | id | select_type | table | type | possible_keys| key  | key_len | ref  | rows  | Extra       |
                  +----+-------------+-------+------+--------------+------+---------+------+-------+------------------+
                  |  1 | SIMPLE      | table | ALL  | NULL         | NULL | NULL    | NULL |157211 | Using where |
                  +----+-------------+-------+------+--------------+------+---------+------+-------+------------------+
                  

                  注意到我剛剛看了一下,ID 字段存儲為 INT 而 PRODUCT_ID 字段存儲為 VARCHAR 可能會有所幫助.這可能是問題的根源嗎?

                  It might be helpful to note that I've just taken a look, and ID field is stored as INT whereas the PRODUCT_ID field is stored as VARCHAR. Could this be the source of the problem?

                  推薦答案

                  ALTER TABLE `table` ADD INDEX `product_id_index` (`product_id`)
                  

                  永遠不要在 MySQL 中比較 integerstrings.如果 idint,請刪除引號.

                  Never compare integer to strings in MySQL. If id is int, remove the quotes.

                  這篇關于如何向 MySQL 表添加索引?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 數據幀讀取?)
                      <tbody id='rNnjk'></tbody>

                    • <bdo id='rNnjk'></bdo><ul id='rNnjk'></ul>

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

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

                            主站蜘蛛池模板: 日韩av福利在线观看 | 91xxx在线观看 | 一区二区在线免费播放 | 国产成人精品免费视频大全最热 | 日日操操 | 日本精品在线播放 | 99reav| 亚洲欧美日韩在线不卡 | 自拍偷拍一区二区三区 | 欧美片网站免费 | 欧美一区在线视频 | 精品一区二区三区在线视频 | 久久激情视频 | 蜜桃视频成人 | 日本特黄a级高清免费大片 成年人黄色小视频 | 香蕉久久a毛片 | 欧美一级黄色片 | 国产一区二区三区色淫影院 | 在线中文字幕亚洲 | 天天操欧美| 精品自拍视频 | 天天操天天摸天天爽 | 日日干天天操 | 91福利在线观看视频 | 国产精品日韩欧美一区二区三区 | 成人国产精品一级毛片视频毛片 | 日韩精品一区二区三区久久 | 伊人免费在线观看 | 亚洲一区二区三区四区五区午夜 | 一区中文字幕 | 青青伊人久久 | 久久av网| 国产蜜臀 | 午夜精品一区二区三区在线视频 | 亚洲 欧美 日韩在线 | 91影院| 亚洲一区欧美一区 | 欧美日韩在线播放 | 亚洲精品66 | 国产精品久久 | 精品入口麻豆88视频 |