Skip to content

Instantly share code, notes, and snippets.

View akash-coded's full-sized avatar
🎯
Focusing

Akash Das akash-coded

🎯
Focusing
View GitHub Profile
@akash-coded
akash-coded / mysql-indexing.md
Last active February 4, 2020 09:49
Description about different types of constraints and all the implicit and excpilict indexing behaviour in MySQL.

MySQL can create composite indexes (that is, indexes on multiple columns). An index may consist of up to 16 columns.

MySQL can use multiple-column indexes for queries that test all the columns in the index, or queries that test just the first column, the first two columns, the first three columns, and so on. If you specify the columns in the right order in the index definition, a single composite index can speed up several kinds of queries on the same table.

A multiple-column index can be considered a sorted array, the rows of which contain values that are created by concatenating the values of the indexed columns.

Suppose that a table has the following specification:

CREATE TABLE test (
 id INT NOT NULL,