|
|
|
|
|
by slver
1896 days ago
|
|
It may be fast on its own, but I doubt it's faster than cursor+offset. Your idea is to materialize a slice starting from the cursor and offsetting within it. This means we still do offset, but without the cursor. The thing is, the cursor is a lookup on an indexed sorted index, it's O(log N), it's effectively free already. And we add the cost of materializing the slice (if even just in memory), and introducing the potential of DoS-ing our server with this temporary state if we're not careful. |
|
insert into temp select id, date from tbl where id >= c_id and date >= c_date order by date desc, id desc limit 500
I don't see doing any offset over the whole dataset.
> And we add the cost of materializing the slice (if even just in memory)
The alternative is to transfer 400 full rows of data that will be used just to compute pages.
> and introducing the potential of DoS-ing our server with this temporary state if we're not careful.
I don't see any DoS vector specific to this but I'd be thrilled to learn of one.