{"id":6883,"date":"2018-08-19T06:52:29","date_gmt":"2018-08-19T13:52:29","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=6883"},"modified":"2024-01-05T03:16:40","modified_gmt":"2024-01-05T10:16:40","slug":"mysql-use-index","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/","title":{"rendered":"MySQL USE INDEX Hint"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use the MySQL <code>USE INDEX<\/code> hint&nbsp;to instruct the query optimizer to use only a list of named indexes for a query.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL USE INDEX hint<\/h2>\n\n\n\n<p>In MySQL, when you submit an SQL query to the database server, the query optimizer attempts to create an optimal query execution plan.<\/p>\n\n\n\n<p>To determine the best possible plan, the query optimizer relies on several parameters. One of the most crucial parameters for selecting the appropriate index is <strong>stored key distribution<\/strong>, also known as <strong><a href=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-index-cardinality\/\">cardinality<\/a><\/strong>.<\/p>\n\n\n\n<p>The cardinality, however, may be not accurate. For example, if the table has been modified heavily with many inserts or deletes, the cardinality is not updated timely.<\/p>\n\n\n\n<p>To address this issue, you should run the <code>ANALYZE TABLE<\/code> statement periodically to update the cardinality.<\/p>\n\n\n\n<p>In addition, MySQL allows you to recommend the indexes that the query optimizer should consider using an index hint.<\/p>\n\n\n\n<p>Here&#8217;s the basic syntax for using the <code>USE INDEX<\/code> hint:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> select_list\n<span class=\"hljs-keyword\">FROM<\/span> table_name <span class=\"hljs-keyword\">USE<\/span> <span class=\"hljs-keyword\">INDEX<\/span>(index_list)\n<span class=\"hljs-keyword\">WHERE<\/span> condition;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax, the <code>USE INDEX<\/code> instructs the query&nbsp;optimizer to use one of the named indexes to find rows in the table.<\/p>\n\n\n\n<p>Notice that when you recommend the indexes to use, the query\u00a0optimizer may decide to use them or not depending on the query plan that it comes up with.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL USE INDEX example<\/h2>\n\n\n\n<p>We will use the <span style=\"color: #222222; font-family: monospace;\"><span style=\"background-color: #e9ebec;\">customers&nbsp;<\/span><\/span>table from the <a href=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/mysql-sample-database\/\">sample database<\/a> for the demonstration:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/customers.svg\" alt=\"\" class=\"wp-image-10765\"\/><\/figure>\n\n\n\n<p>First, use the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-show-indexes\/\">SHOW INDEXES<\/a><\/code> statement to display all indexes of the &nbsp;<code>customers<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SHOW<\/span> <span class=\"hljs-keyword\">INDEXES<\/span> <span class=\"hljs-keyword\">FROM<\/span> customers;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1061\" height=\"54\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2018\/08\/MySQL-USE-INDEX-example.png\" alt=\"MySQL USE INDEX example\" class=\"wp-image-6885\" title=\"MySQL USE INDEX example\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2018\/08\/MySQL-USE-INDEX-example.png 1061w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2018\/08\/MySQL-USE-INDEX-example-200x10.png 200w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2018\/08\/MySQL-USE-INDEX-example-768x39.png 768w\" sizes=\"auto, (max-width: 1061px) 100vw, 1061px\" \/><\/figure>\n\n\n\n<p>Second, create four indexes as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">INDEX<\/span> idx_c_ln  <span class=\"hljs-keyword\">ON<\/span> customers(contactLastName);\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">INDEX<\/span> idx_c_fn <span class=\"hljs-keyword\">ON<\/span> customers(contactFirstName);\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">INDEX<\/span> idx_name_fl  <span class=\"hljs-keyword\">ON<\/span> customers(contactFirstName,contactLastName);\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">INDEX<\/span> idx_name_lf  <span class=\"hljs-keyword\">ON<\/span> customers(contactLastName,contactFirstName);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Third, find customers whose contact first name or contact last name starts with the letter A. Use the <code>EXPLAIN<\/code> statement check which indexes are used:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">EXPLAIN<\/span> <span class=\"hljs-keyword\">SELECT<\/span> *\n<span class=\"hljs-keyword\">FROM<\/span>\n    customers\n<span class=\"hljs-keyword\">WHERE<\/span>\n    contactFirstName <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'A%'<\/span>\n        <span class=\"hljs-keyword\">OR<\/span> contactLastName <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'A%'<\/span>\\G<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following shows the output of the statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">           id: 1\n  select_type: SIMPLE\n        table: customers\n   partitions: NULL\n         type: index_merge\npossible_keys: idx_c_ln,idx_c_fn,idx_name_fl,idx_name_lf\n          key: idx_c_fn,idx_c_ln\n      key_len: 52,52\n          ref: NULL\n         rows: 16\n     filtered: 100.00\n        Extra: Using sort_union(idx_c_fn,idx_c_ln); Using where\n1 row in <span class=\"hljs-keyword\">set<\/span>, <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">warning<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The output indicates that the query optimizer used the <code>idx_c_fn<\/code> and <code>idx_c_ln<\/code> indexes.<\/p>\n\n\n\n<p>Fourth, if you think that it is better to use the <code>idx_c_fl<\/code> and <code>idx_c_lf<\/code> indexes, you use the <code>USE INDEX<\/code> clause as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">EXPLAIN<\/span> <span class=\"hljs-keyword\">SELECT<\/span> *\n<span class=\"hljs-keyword\">FROM<\/span>\n    customers\n<span class=\"hljs-keyword\">USE<\/span> <span class=\"hljs-keyword\">INDEX<\/span> (idx_name_fl, idx_name_lf)\n<span class=\"hljs-keyword\">WHERE<\/span>\n    contactFirstName <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'A%'<\/span>\n        <span class=\"hljs-keyword\">OR<\/span> contactLastName <span class=\"hljs-keyword\">LIKE<\/span> <span class=\"hljs-string\">'A%'<\/span>\\G<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Notice that this is just for demonstration purposes, not the best choice though.<\/p>\n\n\n\n<p>The following illustrates the output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">           id: 1\n  select_type: SIMPLE\n        table: customers\n   partitions: NULL\n         type: index_merge\npossible_keys: idx_name_fl,idx_name_lf\n          key: idx_name_fl,idx_name_lf\n      key_len: 52,52\n          ref: NULL\n         rows: 16\n     filtered: 100.00\n        Extra: Using sort_union(idx_name_fl,idx_name_lf); Using where\n1 row in <span class=\"hljs-keyword\">set<\/span>, <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">warning<\/span> (<span class=\"hljs-number\">0.00<\/span> sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>These are the changes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>possible_keys<\/code> column only lists the indexes specified in the <code>USE INDEX<\/code> clause.<\/li>\n\n\n\n<li>The key column has both <code>idx_name_fl<\/code> and <code>idx_name_lf<\/code>. It means that the query optimizer used the recommended indexes instead.<\/li>\n<\/ul>\n\n\n\n<p>The <code>USE INDEX<\/code> can be useful if the query optimizer uses the wrong index from the list of possible indexes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the MySQL <code>USE INDEX<\/code> hint to instruct the query optimizer to use the only list of specified indexes.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"6883\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/\"\n\t\t\t\tdata-post-title=\"MySQL USE INDEX Hint\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"6883\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/\"\n\t\t\t\tdata-post-title=\"MySQL USE INDEX Hint\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows you how to use the MySQL USE INDEX hint\u00a0instruct the query optimizer to use only a list of named indexes for a query.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":6818,"menu_order":11,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6883","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>An Essential Guide to MySQL USE INDEX Hint by Examples<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use the MySQL USE INDEX hint\u00a0instruct the query optimizer to use only a list of named indexes for a query.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"An Essential Guide to MySQL USE INDEX Hint by Examples\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use the MySQL USE INDEX hint\u00a0instruct the query optimizer to use only a list of named indexes for a query.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-05T10:16:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/customers.svg\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/mysql-use-index\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/mysql-use-index\\\/\",\"name\":\"An Essential Guide to MySQL USE INDEX Hint by Examples\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/mysql-use-index\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/mysql-use-index\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/customers.svg\",\"datePublished\":\"2018-08-19T13:52:29+00:00\",\"dateModified\":\"2024-01-05T10:16:40+00:00\",\"description\":\"This tutorial shows you how to use the MySQL USE INDEX hint\u00a0instruct the query optimizer to use only a list of named indexes for a query.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/mysql-use-index\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/mysql-use-index\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/mysql-use-index\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/customers.svg\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/customers.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/mysql-use-index\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Index\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-index\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL USE INDEX Hint\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"An Essential Guide to MySQL USE INDEX Hint by Examples","description":"This tutorial shows you how to use the MySQL USE INDEX hint\u00a0instruct the query optimizer to use only a list of named indexes for a query.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/","og_locale":"en_US","og_type":"article","og_title":"An Essential Guide to MySQL USE INDEX Hint by Examples","og_description":"This tutorial shows you how to use the MySQL USE INDEX hint\u00a0instruct the query optimizer to use only a list of named indexes for a query.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/","og_site_name":"MySQL Tutorial","article_modified_time":"2024-01-05T10:16:40+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/customers.svg","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/","url":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/","name":"An Essential Guide to MySQL USE INDEX Hint by Examples","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/customers.svg","datePublished":"2018-08-19T13:52:29+00:00","dateModified":"2024-01-05T10:16:40+00:00","description":"This tutorial shows you how to use the MySQL USE INDEX hint\u00a0instruct the query optimizer to use only a list of named indexes for a query.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/customers.svg","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/customers.svg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-index\/mysql-use-index\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Index","item":"https:\/\/www.mysqltutorial.org\/mysql-index\/"},{"@type":"ListItem","position":3,"name":"MySQL USE INDEX Hint"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/6883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=6883"}],"version-history":[{"count":3,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/6883\/revisions"}],"predecessor-version":[{"id":14275,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/6883\/revisions\/14275"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/6818"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=6883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}