mysql in show It contains a lot of instructions , for example show table status, show innodb And so on. ,

Today we'll talk about mysql in SHOW  INDEX FROM tableName

The table used in this example has sql sentence

`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id Self increasing , Primary key ',
`name` varchar(12) NOT NULL DEFAULT '' COMMENT ' User name ',
`sex` tinyint(1) NOT NULL DEFAULT '' COMMENT ' User's gender ,0 A secret ,1 Woman ,2 male ',
`score` int(3) NOT NULL COMMENT ' fraction ',
`class_id` varchar(12) NOT NULL COMMENT ' class ',
`school_id` int(11) NOT NULL COMMENT ' School id',
`created_time` int(11) NOT NULL DEFAULT '' COMMENT ' Creation time ',
`updated_time` int(11) NOT NULL DEFAULT '' COMMENT ' Update time ',

Let's create three indexes first :

 CREATE INDEX name_Index ON `user`(`name`(5));
2 CREATE INDEX school_Index ON `user`(`school_id`);
3 CREATE INDEX class_score_Index ON `user`(`class`, `score`);


stay mysql Website in He explained the following fields like this

table : The name of the table

Non_unique :   If the column index does not include duplicate values, then 0 Otherwise 1

Key_name : The index name , If it's a primary key Then for PRIMARY

Seq_in_index : The serial number of the sequence in the index , from 1 Start , If it's a composite index Then the fields are listed in the order they were indexed Such as ('c1', 'c2', 'c3') that Respectively 1, 2, 3

Column_name : Column name

Collation :  How columns are stored in indexes . stay MySQL in , Valuable ‘A’( Ascending ) or NULL( No order )

Cardinality :   An estimate of the number of unique values in the index , By running  ANALYZE TABLE or myisamchk -a  To update , The cardinality is counted according to the statistics stored as integers , So it's not necessary to be too precise for small tables , And for big data tables , The larger the modification, the more the combination ,MySQL The machine that uses the index The bigger it will be .

Sub_part : Length of index , If it is partially indexed Then the value represents the length of the index , If the whole column is indexed, then null, for example name_Index and school_Index Two indexes , Compare the above two indexes when they are created

Packed :  Indicates how keywords are compressed . If it's not compressed , Then for NULL

Null : If the value of the column has NULL, It is YES Otherwise NO..

Index_type : The indexing method used (BTREE, FULLTEXT, HASH, RTREE)

Commnet :  Information about indexes that are not described in their columns

Index_comment :  Any comment on an index that provides an annotation property for index creation

SHOW INDEX Have you used it ??? More articles about

  1. MySQL Optimize it ICP (index condition pushdown: Push... Under index conditions )

    ICP Technology is in MySQL5.6 An index optimization technique introduced in . It can reduce the use of Secondary indexes Filter where The number of returns to the table under the condition and Reduce MySQL server The number of interactions between the engine layer and the engine layer . In the index organization table , Use secondary index to ...

  2. stay v-for In the use of index To add... To the first item class(vue2.0)

    <li v-for="(el,index) in event" v-bind:class="{ 'm-swipe-active': !index}"> ...

  3. Ubuntu-server Next Apache2 To configure .htaccess hide thinkPHP project index.php

    Need to open Apache2 Of rewrite modular 1. open /etc/apache2/apache2.conf In the file AllowOverride None Change it to AllowOverride All 2. modify m ...

  4. SQL Server- Focus on mandatory index query conditions and Columnstore Index( Nine )

    Preface In this section, we will talk about index knowledge , I'll talk about date types in data types later , Short content , In depth understanding ,Always to review the basics. Force index query conditions We also talked about the knowledge of forced index query ...

  5. directx12 in vetex buffer、index buffer and constant buffer binding piple line The timing of

    Category opportunity function build Heap vetex buffer stay Draw Function ID3D12GraphicsCommandList::IASetVertexBuffer no index buffer stay Dr ...

  6. URL_MODEL 2 Cannot access stay APACHE Access mode on the server index.php

    thinkphp URL_MODEL=2, Access link  Report errors : Not Found The requested URL /on ...

  7. index+match The best use of function in compactness for random non repetition of box number and box quality

    First, arrange the box number and quality in ascending order , Make it one to one , Box number     Box weight     Random value rand()     Random value size arrangement rank 1         2001       0.01             ...

  8. [LeetCode] Random Pick Index Random pick sequence

    Given an array of integers with possible duplicates, randomly output the index of a given target num ...

  9. Zend Framework project index.php The problem of

    Default generated Zend The project in public The directory will automatically generate a .htaccess file , This is for pseudo static , That is, to hide index.php This is the only entry file . however , There was a problem building the project :URL If you don't add inde ...

  10. 0103MySQL Medium B-tree Indexes USINGWHERE and USING INDEX At the same time

    From the blog Premise 1, In order to keep pace with the times , The database environment is MySQL5.6 edition 2, For the sake of generality , More to avoid the pain of creating data , The tables mentioned in this paper . data , All come from My ...

Random recommendation

  1. notice 、block

    =================================== notice =================================== One . notice (NSNotification) // N ...

  2. Explore javascript---- All kinds of events under the event object X and Y

    Every time you use something like client,screen,offset etc. , Although it's usually right , But I always feel that I'm not so confident . So sort it out and look it up when you need it . One :clientX and clientY,screenX and s ...

  3. android There are several ways to get a pump in

    1, Briefly explain , The pump is to put our xml The layout is transformed into our view object , Not far , Look directly at the code A: from context In order to get LayoutInflater inflater1 = LayoutInflater ...

  4. C# OpenFileDialog

    OpenFileDialog For browsing and opening files , stay Windows Forms Use in , Behave as standard Windows Dialog box . example : 1. newly build Windows Form Application 2. add to Op ...

  5. flume from kafka Read data to hdfs Configuration in

    #source Name agent.sources = kafkaSource # channels Name , It is suggested to follow type Named after the agent.channels = memoryChannel # si ...

  6. Serializable The function of serialization

    Here is an explanation java serialize (Serializable) And deserialization aspects of the feel good article .1. What is serialization for ? In short, it is to save the state of various objects in memory ( That is, instance variables , It's not the way ), And you can save the ...

  7. Ubuntu16.04 Boot missing Win10

    Ubuntu Under normal power on condition : sudo update-grub # If grub The loss of , First sudo apt install grub Ubuntu It doesn't work : Get into Ubuntu guide , Don't go in normally ...

  8. Study React series ( Four )—— Controlled and uncontrolled components

    Controlled components : Control components by changing their states and properties Uncontrollable components : Directly through the bottom dom To control the components ( Specifically, it's through binding to the bottom dom It is realized by using the method of , for instance ref,onChange) Controlled components functio ...

  9. HttpUrlConnection Streaming problems ( Correct transmission of JSON character string )

    Now I'm writing a function , Mainly used HttpURLConnection send out http Request to call the external interface . Everything was normal , But it's sending post Request to upload data to the server , The server returns an error message : Acquired JSON Requests are garbled ...

  10. 【XMPP】 be based on XMPP Instant messaging solutions for

    What is? XMPP Introduce XMPP Before , First look at it. GTalk. GTalk yes Google To launch the IM(Instant Messaging, im ) Software , Be similar to QQ and MSN. From a technical point of view ,GTalk And QQ and ...