当前位置:网站首页>Mysql--索引原理+如何使用
Mysql--索引原理+如何使用
2022-07-03 09:32:00 【Samooyou】
一 、介绍
为何要有索引?
一般的应用系统,读写比例在10:1左右,而且插入操作和一般的更新操作很少出现性能问题,在生产环境中,我们遇到最多的,也是最容易出问题的,还是一些复杂的查询操作,因此对查询语句的优化显然是重中之重。说起加速查询,就不得不提到索引了。
什么是索引?
索引在MySQL中也叫做“键”,是存储引擎用于快速找到记录的一种数据结构。索引对于良好的性能
非常关键,尤其是当表中的数据量越来越大时,索引对于性能的影响愈发重要。
索引优化应该是对查询性能优化最有效的手段了。索引能够轻易将查询性能提高好几个数量级。
索引相当于字典的音序表,如果要查某个字,如果不使用音序表,则需要从几百页中逐页去查。
你是否对索引存在误解?
索引是应用程序设计和开发的一个重要方面。若索引太多,应用程序的性能可能会受到影响。而索引太少,对查询性能又会产生影响,要找到一个平衡点,这对应用程序的性能至关重要。一些开发人员总是在事后才想起添加索引----我一直认为,这源于一种错误的开发模式。如果知道数据的使用,从一开始就应该在需要处添加索引。开发人员往往对数据库的使用停留在应用的层面,比如编写SQL语句、存储过程之类,他们甚至可能不知道索引的存在,或认为事后让相关DBA加上即可。DBA往往不够了解业务的数据流,而添加索引需要通过监控大量的SQL语句进而从中找到问题,这个步骤所需的时间肯定是远大于初始添加索引所需的时间,并且可能会遗漏一部分的索引。当然索引也并不是越多
边栏推荐
- Preliminary knowledge of Neural Network Introduction (pytorch)
- I really want to be a girl. The first step of programming is to wear women's clothes
- Leetcode刷题---283
- Leetcode skimming ---278
- A complete answer sheet recognition system
- Numpy realizes the classification of iris by perceptron
- Leetcode刷题---1385
- Ind kwf first week
- Leetcode刷题---977
- 神经网络入门之矩阵计算(Pytorch)
猜你喜欢
Multi-Task Feature Learning for Knowledge Graph Enhanced Recommendation
Hands on deep learning pytorch version exercise answer - 2.2 preliminary knowledge / data preprocessing
丢弃法Dropout(Pytorch)
Handwritten digit recognition: CNN alexnet
Leetcode刷题---367
6、 Data definition language of MySQL (1)
ThreadLocal principle and usage scenario
Linear regression of introduction to deep learning (pytorch)
Ut2013 learning notes
Convolutional neural network (CNN) learning notes (own understanding + own code) - deep learning
随机推荐
Raspberry pie 4B deploys lnmp+tor and builds a website on dark web
Tensorflow—Neural Style Transfer
extern关键字
Classification (data consolidation and grouping aggregation)
Leetcode刷题---283
Timo background management system
Softmax regression (pytorch)
Ut2015 learning notes
[ultra detailed] implement soft and hard interval SVM based on sklearn
深度学习入门之自动求导(Pytorch)
mysql5.7安装和配置教程(图文超详细版)
[roast & brain hole] Some Thoughts on the bullet screen interactive game of Wei Shu Wu Three Kingdoms when visiting station B
Numpy quick start (II) -- Introduction to array (creation of array + basic operation of array)
Ut2016 learning notes
2018 y7000 upgrade hard disk + migrate and upgrade black apple
Convolutional neural network (CNN) learning notes (own understanding + own code) - deep learning
EFFICIENT PROBABILISTIC LOGIC REASONING WITH GRAPH NEURAL NETWORKS
侯捷——STL源码剖析 笔记
Leetcode刷题---75
Free online markdown to write a good resume