|
One path a table database might choose is to look at each row in the table to find records that match the filter. This is called a sequential scan or full table scan. If you are working with large data sets sequential scans can slow down queries. The time required to find records is affected by the size of the data set. The larger the data set, the longer it takes to retrieve the records. An index scan first looks for metadata to find records faster. Another path a database might choose is to query the index to match the filter to the values available in the index. table to get more data such as more columns. This is called an index scan. An index-only scan finds records directly in the index. The database may also choose to return matching records from the index without even consulting the original table.
This is called an index-only scan. This can hap photo editing servies pen when the column being returned and filtered already exists in the index. Below is an example where an index-only scan can be used. Other database providers such as support other types of query plans such as bitmap heap scans and bitmap index scans are not covered in this series. The price you pay for faster reads The general consensus is that indexes are very useful for improving read performance. However, indexing comes at a cost. Your write operations will incur additional overhead. This is because every write requires updating the index. Another cost of indexes is that they require additional resources from the database server for maintenance.

Indexes require additional storage memory and memory from the database server. A general rule of thumb is to use indexes sparingly on frequently queried columns. You should also choose the appropriate index type based on your requirements. Summary and Next Steps In this article you learned what a database index is, the anatomy of different types of database queries, and the costs of using database indexes to optimize queries. In the next article you'll learn how to use indexes in your application to improve the performance of existing queries. Education Don’t miss the next article.
|
|