Page与Slice

官方文档

A Page knows about the total number of elements and pages available. It does so by the infrastructure triggering a count query to calculate the overall number. As this might be expensive (depending on the store used), you can instead return a Slice. A Slice only knows about whether a next Slice is available, which might be sufficient when walking through a larger result set.

  

大概的意思就是说Page实现了获取所有记录的数量和页面的总数,但是它是通过count query来计算的,所以这个代价就是很大的。

所以,当我们有一个很大的数据集的时候,Slice可能就能满足我们的需求了。因为大多数时候,我们并不需要知道结果集总数是多少。

posted @ 2019-09-12 17:07  灵丶诚  阅读(303)  评论(0编辑  收藏  举报