|
|
|
|
|
by adamzochowski
2481 days ago
|
|
> Otherwise it does not matter how many columns you select, because you will have to read all the columns for every row anyway. It does matter. An index can actually contain a cache of values for some columns. This is done with INCLUDE statement. CREATE INDEX idx
ON book ( author_id )
INCLUDE ( book_title )
This select will use only index: select author_id, book_title
from books
where author_id = 123
This select will use index, and then have to follow and fetch data out of rows: select *
from books
where author_id = 123
https://use-the-index-luke.com/blog/2019-04/include-columns-... |
|