We use orc as the storage format for our real-time data warehouse, our online query will have a lot of random reads and frequent seeks. We found that a lot of time is consumed in SeekToRowGroup and Skip.
Many of our target rows in multiple seeks are in the same row group, This leads to the problem in my title.
For example, there is an online query, we need to read the data of row 100 and row 130,
The current behavior is
- SeekToRowGroup
- Skip(100)
- Next(1)
- SeekToRowGroup
- Skip(130)
- Next(1)
Why not
- SeekToRowGroup
- Skip(100)
- Next(1)
- Skip(29)
- Next(1)
We simply modified the code and found that in our scenario it can bring at least 50% read performance benefits.