zoukankan      html  css  js  c++  java
  • MYSQL强制使用索引和禁止使用索引

    mysql强制索引和禁止某个索引

    1、mysql强制使用索引:force index(索引名或者主键PRI)

    例如:

    select * from table force index(PRI) limit 2;(强制使用主键)

    select * from table force index(ziduan1_index) limit 2;(强制使用索引"ziduan1_index")

    select * from table force index(PRI,ziduan1_index) limit 2;(强制使用索引"PRI和ziduan1_index")

    2、mysql禁止某个索引:ignore index(索引名或者主键PRI)

    例如:

    select * from table ignore index(PRI) limit 2;(禁止使用主键)

    select * from table ignore index(ziduan1_index) limit 2;(禁止使用索引"ziduan1_index")

    select * from table ignore index(PRI,ziduan1_index) limit 2;(禁止使用索引"PRI,ziduan1_index")

  • 相关阅读:
    Vim使用
    软件测试基础知识
    数字成像系统
    linux操作系统运行学习总结
    python算法学习总结
    Django Rest Framework框架
    mysql学习笔记一
    学习方法
    算法模板汇总
    习题练习1
  • 原文地址:https://www.cnblogs.com/xiaoleiel/p/8316520.html
Copyright © 2011-2022 走看看