27.2k views
1 vote
Why is LRU bad for a sequential scan?

1 Answer

7 votes

Final answer:

LRU is bad for a sequential scan because it may evict frequently used items from the cache, resulting in cache misses and reduced performance.

Step-by-step explanation:

LRU stands for Least Recently Used and it is a popular caching algorithm. However, it can be inefficient for a sequential scan. A sequential scan, also known as a linear scan, is a process of examining each element in a dataset in a specific order, typically from start to end.

When performing a sequential scan, the LRU algorithm may evict frequently used items from the cache, as they are not accessed consecutively. This can result in cache misses and reduced performance, since the algorithm prioritizes items based on their recent access history rather than the order in which they appear in the dataset.

As an alternative, a different caching algorithm like a FIFO (First-In, First-Out) or LFU (Least Frequently Used) may be more suitable for a sequential scan, as they retain items based on their order of insertion or frequency of access, respectively.

User Callebe
by
8.2k points