CREATE INDEX
Published Aug 22, 2022
Contribute to Docs
The CREATE INDEX
command creates an index on one or more existing columns from a table. Indexes cannot be seen by the user of a database; they just help speed up queries.
Syntax
CREATE INDEX index
ON table (column1, column2);
Note: Tables with indexes update slower, so indexes should generally be used on columns that will be searched often but not updated frequently.
Example
This example creates an index called idx_student_name
on the student_name
column in the students
table:
CREATE INDEX idx_student_nameON students student_name;
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.