Skip to content

Commit fe364e6

Browse files
authored
docs: Reference the pagination recipe from the mentions of the 50,000 row limit (#6434)
* Clean up query code examples * Add links
1 parent ebb6836 commit fe364e6

File tree

4 files changed

+50
-32
lines changed

4 files changed

+50
-32
lines changed

docs/content/Examples-Tutorials-Recipes/Recipes/pagination.mdx

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,43 @@ cube(`Orders`, {
4444
## Query
4545

4646
To select orders that belong to a particular page, we can use the `limit` and
47-
`offset` query properties. First, we get the number of all orders that we have.
48-
Then we should set the `limit` and `offset` properties for the queries that will
49-
get the orders from the Cube API.
50-
51-
```bash{outputLines: 1,3-4}
52-
# Get count of the orders
53-
curl cube:4000/cubejs-api/v1/load \
54-
-H "Authorization: eeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoib3BlcmF0b3IiLCJpYXQiOjE2Mjg3NDUwNDUsImV4cCI6MTgwMTU0NTA0NX0.VErb2t7Bc43ryRwaOiEgXuU5KiolCT-69eI_i2pRq4o" \
55-
"query={"measures": ["Orders.count"]}"
47+
`offset` query properties. First, let's get the number of all orders that we have.
48+
49+
```json
50+
{
51+
"measures": [
52+
"Orders.count"
53+
]
54+
}
5655
```
5756

58-
```bash{outputLines: 1,3-4}
59-
# Get first five orders
60-
curl cube:4000/cubejs-api/v1/load \
61-
-H "Authorization: eeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoib3BlcmF0b3IiLCJpYXQiOjE2Mjg3NDUwNDUsImV4cCI6MTgwMTU0NTA0NX0.VErb2t7Bc43ryRwaOiEgXuU5KiolCT-69eI_i2pRq4o" \
62-
"query={"order": [["Orders.number", "asc"]], "dimensions": ["Orders.number"], "limit": 5}"
57+
Then, let's retrieve first batch (page) of five orders:
58+
59+
```json
60+
{
61+
"dimensions": [
62+
"Orders.number"
63+
],
64+
"order": {
65+
"Orders.number": "asc"
66+
},
67+
"limit": 5
68+
}
6369
```
6470

65-
```bash{outputLines: 1,3-4}
66-
# Get next five orders
67-
curl cube:4000/cubejs-api/v1/load \
68-
-H "Authorization: eeyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoib3BlcmF0b3IiLCJpYXQiOjE2Mjg3NDUwNDUsImV4cCI6MTgwMTU0NTA0NX0.VErb2t7Bc43ryRwaOiEgXuU5KiolCT-69eI_i2pRq4o" \
69-
"query={"order": [["Orders.number", "asc"]], "dimensions": ["Orders.number"], "limit": 5, "offset": 5}"
71+
Now, let's retrieve the second batch (page) of five orders:
72+
73+
```json
74+
{
75+
"dimensions": [
76+
"Orders.number"
77+
],
78+
"order": {
79+
"Orders.number": "asc"
80+
},
81+
"limit": 5,
82+
"offset": 5
83+
}
7084
```
7185

7286
## Result

docs/content/REST-API/Query-Format.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ A Query has the following properties:
3535
- `segments`: An array of segments. A segment is a named filter, created in the
3636
Data Schema.
3737
- `limit`: A row limit for your query. The default value is `10000`. The maximum
38-
allowed limit is `50000`.
38+
allowed limit is `50000`. If you'd like to request more rows than the maximum
39+
allowed limit, consider using [pagination][ref-recipe-pagination].
3940
- `offset`: The number of initial rows to be skipped for your query. The default
4041
value is `0`.
4142
- `order`: An object, where the keys are measures or dimensions to order by and
@@ -590,6 +591,7 @@ date. If you need the current date also you can use `from N days ago to now` or
590591
}
591592
```
592593

594+
[ref-recipe-pagination]: /recipes/pagination
593595
[ref-client-core-resultset-drilldown]:
594596
/@cubejs-client-core#result-set-drill-down
595597
[ref-schema-ref-preaggs-refreshkey]:

docs/content/Reference/GraphQL-API/GraphQL-API.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ query {
2525

2626
## `CubeQueryArgs`
2727

28-
| Key | Schema | Description |
29-
| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
30-
| `where` | [`RootWhereInput`](#root-where-input) | Represents a SQL `WHERE` clause |
31-
| `limit` | `Int` | A row limit for your query. The default value is `10000`. The maximum allowed limit is `50000` |
32-
| `offset` | `Int` | The number of initial rows to be skipped for your query. The default value is `0` |
33-
| `timezone` | `String` | The timezone to use for the query. The default value is `UTC` |
34-
| `renewQuery` | `Boolean` | If `renewQuery` is set to `true`, Cube will renew all `refreshKey` for queries and query results in the foreground. The default value is `false` |
28+
| Key | Schema | Description |
29+
| ------------ | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
30+
| `where` | [`RootWhereInput`](#root-where-input) | Represents a SQL `WHERE` clause |
31+
| `limit` | `Int` | A row limit for your query. The default value is `10000`. The maximum allowed limit is `50000`. If you'd like to request more rows than the maximum allowed limit, consider using [pagination][ref-recipe-pagination]. |
32+
| `offset` | `Int` | The number of initial rows to be skipped for your query. The default value is `0` |
33+
| `timezone` | `String` | The timezone to use for the query. The default value is `UTC` |
34+
| `renewQuery` | `Boolean` | If `renewQuery` is set to `true`, Cube will renew all `refreshKey` for queries and query results in the foreground. The default value is `false` |
35+
36+
[ref-recipe-pagination]: /recipes/pagination
3537

3638
## `RootWhereInput`
3739

docs/content/SQL-API/Overview.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ time dimension date ranges whenever it's possible.
193193
Cube tries to push down all `ORDER BY` statements into Cube Query.
194194

195195
If it can't be done ordering part would be done in a post-processing phase. In
196-
case there are more than 50k rows in the result set, incorrect results can be
196+
case there are more than 50,000 rows in the result set, incorrect results can be
197197
received in this case. Please use `EXPLAIN` in order to check if it's the case.
198198

199199
Consider the following query.
@@ -223,14 +223,14 @@ see below, the sorting operation is done after Cube query and projection.
223223
+--- CubeScanExecutionPlan
224224
```
225225

226-
Because of the default limit in Cube queries (50k rows), there is a possibility
227-
of a wrong result if there are more than 50k rows. Given that queries to Cube
228-
are usually aggregated, it is rare that they may return more than 50k rows, but
226+
Because of the default limit in Cube queries (50,000 rows), there is a possibility
227+
of a wrong result if there are more than 50,000 rows. Given that queries to Cube
228+
are usually aggregated, it is rare that they may return more than 50,000 rows, but
229229
keep that limitation in mind when designing your queries.
230230

231231
### <--{"id" : "Querying cube tables"}--> Limit
232232

233-
Limit push down is supported by Cube however, a limit over 50k can't be
233+
Limit push down is supported by Cube however, a limit over 50,000 can't be
234234
overridden. In future versions, paging and streaming would be used to avoid this
235235
limitation.
236236

0 commit comments

Comments
 (0)