Full table scan vs index scan

preview_player
Показать описание
Good understanding of #Indexes is very important while working in a #database and #SQL and that's why you will find many questions based upon indexes on Programming Job #interviews.
In this video, we'll go through each three i.e. table scan, index scan, and index seek and try to understand how database process a particular query hence a basic understanding of database, SQL and index are required.

Рекомендации по теме
Комментарии
Автор

the way you said if we mention empid < 5000 then it will use index scan which may not be preferable. how can i use full table scan in this scenario. pls tell the process.

Автор

Thanks for information and I liked your explanation.


Hi I have a table like emp have 5000 employee records .
I have two batches one is daily and another one is monthly .
Daily batch result set is 10% and monthly batch result set is 90% of the table and both batches are using same column in where clause.
Now my question is, any way to force full table scan only during monthly batch ?

harisaim
Автор

One question.. If I am assuming that our indexes are from B+ Tree, and in B+ Tree, on leaf nodes, we always have all the indexes available, and these nodes are also connected as a linkedlist. now if I am able to find the specific index of let's say empId=5000, and through that linked list, i can list all previously existing employees (which only will be 90% and not the full table). Won't this make our range scanning better?

Ajay-qvfk
Автор

Hi Sir, sometime more index will impact that query become slower compare with a significant index. How can we differential that index will burden that query even though the index output is 5% only.

hanshnegkai