Configuring Devicon Pagination via devicon.yml pageSize and pageNumber
Enable and configure Devicon's offset-based pagination with pageSize and pageNumber, then verify the setup with simple log and query checks.
08 Jul 2025, 16:12 UTC

Useful answer: configure pagination in devicon.yml
If you are working with Devicon and need to retrieve data in manageable chunks rather than loading entire result sets into memory, enabling pagination is the practical solution. The framework provides a lightweight configuration-driven mechanism that lets you control how many records are returned per request and which page of results you receive. This approach is especially useful when dealing with large datasets where a single query would be cost-prohibitive or cause memory pressure.
How pagination works
Devicon reads two configuration keys at startup: pageSize, which defines the number of records per page, and pageNumber, which identifies the desired page index. The engine translates these values into offset parameters when constructing the underlying query against the data source. Because the mechanism relies on offset-based access, it only benefits sources that support efficient row-level skipping; sources that require full table scans for each page will not see performance improvement. As a concrete worked example, configuring pageSize: 20 and pageNumber: 3 instructs Devicon to return records 41 through 60 from the full result set, effectively skipping the first 40 rows and limiting the output to the next 20.
The configuration is declared in devicon.yml under a pagination block. A minimal valid snippet appears as follows:
pagination:
enabled: true
pageSize: 20
pageNumber: 3
Verification after configuration
- Inspect the runtime startup log for the line Pagination enabled: true, which indicates the feature recognized the configuration keys.
- Issue a test query with pageNumber set to 1 and pageSize set to 5; the returned result set should contain exactly five records, no more and no less.
- Validate the YAML file using any standard parser; a syntax error or incorrect indentation will cause the pagination block to be silently ignored, and the engine will fall back to returning the complete dataset.
Limits and common mistakes
- Pagination operates exclusively with offset‑based queryable sources; it cannot accelerate queries that require random access or full-table scans for each page.
- Omitting the paginationEnabled: true flag causes the engine to disregard the page parameters entirely and return the full result set, which defeats the purpose of pagination.
- Supplying a pageSize value exceeding the engine's maximum (for example, greater than 10,000) triggers a runtime validation error and the configuration is rejected.
- Combining pagination with server‑side cursors is not supported; the two mechanisms are mutually exclusive and using both will result in undefined behavior.
- Any YAML indentation error within the pagination block will prevent the settings from being read, and the operator may assume pagination is active when it is not.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.