久久久久久久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>

                            主站蜘蛛池模板: 亚洲精品久久久久久久久久久久久 | 国产欧美日韩一区 | 一区二区欧美在线 | 欧美中国少妇xxx性高请视频 | 欧美成人精品 | 中文字幕乱码亚洲精品一区 | 欧美中文字幕 | 在线欧美视频 | 亚洲精品自在在线观看 | 日韩视频在线一区二区 | 啪视频在线 | 精品国产乱码久久久久久老虎 | 日韩一区二区三区视频 | 国产欧美视频一区二区 | 久久久久久久久久久一区二区 | 一本综合久久 | 欧美电影在线观看网站 | 日本三级做a全过程在线观看 | 懂色一区二区三区免费观看 | 久久亚洲天堂 | 二区成人 | 日本久久精品视频 | 久久久www| 中文区中文字幕免费看 | 国产成人精品一区二区三区四区 | 久久久久久亚洲精品不卡 | 91观看| 天天干天天谢 | 中文字幕一区二区在线观看 | 99精品国产一区二区三区 | 日韩一区二区福利视频 | 久久出精品| 国产福利在线视频 | 成人免费视频观看 | 国产欧美一区二区三区在线看 | 色婷婷av一区二区三区软件 | 免费午夜视频 | 日本免费在线观看视频 | 午夜电影日韩 | 中文字幕日本一区二区 | 在线欧美一区二区 |