Skip to content

Commit 0cecfc8

Browse files
authored
util/paging: choose min paging size default value as 128, and max value as 8192 (#36331)
close #36328
1 parent a0cced2 commit 0cecfc8

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

util/paging/paging.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ package paging
1717
import "math"
1818

1919
// A paging request may be separated into multi requests if there are more data than a page.
20-
// The paging size grows from min to max, it's not well tuned yet.
21-
// e.g. a paging request scans over range (r1, r200), it requires 64 rows in the first batch,
20+
// The paging size grows from min to max. See https://github.com/pingcap/tidb/issues/36328
21+
// e.g. a paging request scans over range (r1, r200), it requires 128 rows in the first batch,
2222
// if it's not drained, then the paging size grows, the new range is calculated like (r100, r200), then send a request again.
2323
// Compare with the common unary request, paging request allows early access of data, it offers a streaming-like way processing data.
24-
// TODO: may make the paging parameters configurable.
2524
const (
26-
MinPagingSize uint64 = 64
25+
MinPagingSize uint64 = 128
2726
maxPagingSizeShift = 7
2827
pagingSizeGrow = 2
29-
MaxPagingSize = MinPagingSize << maxPagingSizeShift
28+
MaxPagingSize = 8192
3029
pagingGrowingSum = ((2 << maxPagingSizeShift) - 1) * MinPagingSize
3130
Threshold uint64 = 960
3231
)

util/paging/paging_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222

2323
func TestGrowPagingSize(t *testing.T) {
2424
require.Equal(t, GrowPagingSize(MinPagingSize), MinPagingSize*pagingSizeGrow)
25-
require.Equal(t, GrowPagingSize(MaxPagingSize), MaxPagingSize)
26-
require.Equal(t, GrowPagingSize(MaxPagingSize/pagingSizeGrow+1), MaxPagingSize)
25+
require.Equal(t, GrowPagingSize(MaxPagingSize), uint64(MaxPagingSize))
26+
require.Equal(t, GrowPagingSize(MaxPagingSize/pagingSizeGrow+1), uint64(MaxPagingSize))
2727
}
2828

2929
func TestCalculateSeekCnt(t *testing.T) {

0 commit comments

Comments
 (0)