Closed blackbaud-alanacable closed 5 years ago
On Page2, using the continuation token 9980 documents are returned, on page3, 9960 documents are returned and so on.
I see whats happening now. The data is fetched in the iterator. Im closing this issue, since I was mistaken. Sorry :(
Hi,
Let's say I have a Cosmos database with 10,000 documents. I do a
findAll
query with a page size of 20. On line 498 (in the paginationQuery method) of DocumentDbTemplate, I set a breakpoint. For the first page, I hit that breakpoint and inspectsqlQuerySpec
. The query isSELECT * FROM ROOT r
. The iterator that is returned back contains all 10,000 documents. It is the for loop on the next line that creates a list equal to my page size.My question is, why do all 10,000 documents need to be fetched? This seems very expensive if your database is large. Why not do
select top PAGE_SIZE * from ROOT r
?Thanks, Alana