当前位置:网站首页>mysql index
mysql index
2022-07-31 01:51:00 【my genius girlfriend】
Index: a sorted data, the index records the one-to-one correspondence between the position where the index is added and each row of records in the data in the data table.
An index is like a table of contents in a dictionary.
The way mysql traverses data:
Sequential traversal: the query will traverse the data in the database
Index traversal: find the appropriate index, and then locate the data of the corresponding row in the database according to the index, improving the data query ability
Indexing advantages and disadvantages:
Benefits
- All fields can be indexed
- You can add an index to one or more columns in the table
Disadvantages
- The index needs to occupy a certain position, and the data update also requires internal maintenance of the index within mysql
The principle of mysql index creation
- The smaller the data the better, the less memory it takes up
- Simple data types are best
- Try not to create indexes on null values, null values will make index calculation more difficult
mysql data index adds an index to the primary key or foreign key in the data. There is a certain amount of data in the table. This field is mostly used for data retrieval conditions, and this field is used for grouping and sorting.
Type of index
Unique, fulltext, spatial
Index Creation
alter table tableName add index indexName(columnName)
边栏推荐
猜你喜欢
随机推荐
Arbitrum 专访 | L2 Summer, 脱颖而出的 Arbitrum 为开发者带来了什么?
kotlin中函数作为参数和函数作为返回值实例练习
验证整数输入
最高月薪20K?平均薪资近万...在华为子公司工作是什么体验?
进程间通信学习笔记
Software Testing Defect Reporting - Definition, Composition, Defect Lifecycle, Defect Tracking Post-Production Process, Defect Tracking Process, Purpose of Defect Tracking, Defect Management Tools
Likou Daily Question - Day 46 - 704. Binary Search
Teach you how to configure Jenkins automated email notifications
Word 表格跨页,仍然显示标题
Kyushu cloud as cloud computing standardization excellent member unit
Maximum monthly salary of 20K?The average salary is nearly 10,000... What is the experience of working in a Huawei subsidiary?
勾股数元组 od js
Gateway routing configuration
934. 最短的桥
聚簇索引和非聚簇索引到底有什么区别
[1153]mysql中between的边界范围
C语言小程序 -- 常见经典练习题
leetcode-399: division evaluation
来自一位女测试工程师的内心独白...
Drools WorkBench的简介与使用