Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of creating Index in mysql

Shulou Source: shulou.com Published: 2022-06-03 17:26:34 11月13日 Update

This article mainly explains "the method of creating index in mysql". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the method of creating index in mysql".

1. It appears frequently in where condition field, order sorting field and group by grouping field.

2. Select frequently queries the columns, considering whether it is necessary to create a federated index.

3. For multi-table join associated queries, indexes should be created for fields on both sides of the on field.

Example

CREATE INDEX index_name ON table (column (length)) ALTER TABLE table_name ADD INDEX index_name ON (column (length)) can also create indexes CREATE TABLE `table` (`id` int (11) NOT NULL AUTO_INCREMENT, `title` char (255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, `time` int (10) NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX index_name (title (length)) when creating tables. Thank you for your reading. The above is the content of "index creation method in mysql". After the study of this article, I believe you have a deeper understanding of the index creation method in mysql, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Indexes methods fields learning frequency content queries examples that is ideas situations articles times more conditions knowledge knowledge points articles follow questions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MariaDB Shulou Tech Info Linux Xiaomi