The basic syntax is as follows.Ī composite index is an index on two or more columns of a table. A unique index does not allow any duplicate values to be inserted into the table. Unique indexes are used not only for performance, but also for data integrity. The basic syntax of a CREATE INDEX is as follows.Ī single-column index is created based on only one table column. Indexes can also be unique, like the UNIQUE constraint, in that the index prevents duplicate entries in the column or combination of columns on which there is an index. Indexes can be created or dropped with no effect on the data.Ĭreating an index involves the CREATE INDEX statement, which allows you to name the index, to specify the table and which column or columns to index, and to indicate whether the index is in an ascending or descending order. An index in a database is very similar to an index in the back of a book.įor example, if you want to reference all pages in a book that discusses a certain topic, you first refer to the index, which lists all the topics alphabetically and are then referred to one or more specific page numbers.Īn index helps to speed up SELECT queries and WHERE clauses, but it slows down data input, with the UPDATE and the INSERT statements. Simply put, an index is a pointer to data in a table. Indexes are special lookup tables that the database search engine can use to speed up data retrieval.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |