1.1 SQL Index
1.1 SQL Index
We use the sql INDEX as a way to optimize our database queries. A database
administrator or data architect will usually assign an index to a specific column in a
database table. As a result, the query performance is impacted.
We create a sql index to improve performance of a database table when running sql
queries. An index can be created, modified, or deleted from a database table. We
can review the following sql syntax for the creation, alteration, and removal of
an index.
Create Index SQL Syntax
CREATE INDEX <index_name> ON <table_name> (<column_name>);
The syntax to create indexes on tables is pretty similar across most databases. If
the above referenced syntax doesn’t work then refer to your database syntax
documentation.
It’s important to note that removing an index can have a dramatic effect on
database performance. This is especially true of more established databases. For
example, the ones with several ETL process, procedures, views, and other types of
queries.
We can quickly drop and recreate our index with new columns. An index does not
need to be a single column. They can contain multiple columns. In conclusion, the
use of a sql index is all defined by the types of queries being executed.