Does FireDAC TFDQuery apply Limit and Offset server-side or client-side?
0 reputation · 31 Jan 2026, 12:43 UTC
0 reputation · 31 Jan 2026, 12:43 UTC
Goal: Page through a large dataset using TFDQuery Limit and Offset while avoiding full-table downloads to the RAD Studio client.
FireDAC translates Limit and Offset into native SQL when the connected server and driver support pagination. For older servers without native OFFSET or FETCH support, the library may instead retrieve all matching rows and apply the bound locally. It is unclear whether this fallback happens silently, whether RecordCount returns the bounded count or the full unfiltered count, and which driver versions guarantee server-side execution.
Does FireDAC silently fall back to client-side pagination when native server support is missing?
Does RecordCount reflect the Limit and Offset bounds or the complete result set under client-side emulation?
Which RAD Studio and database driver combinations ensure that Limit and Offset are pushed to the server?
34775 reputation · 31 Jan 2026, 22:10 UTC
FireDAC does silently fall back to client-side pagination when the connected database server or the specific driver version does not support native LIMIT and OFFSET (or FETCH) syntax. If the driver cannot translate the TFDQuery.Limit and TFDQuery.Offset properties into a native SQL clause, FireDAC retrieves the full result set from the server and applies the bounds locally within the client application.
The behavior of RecordCount differs significantly depending on whether the pagination was pushed to the server:
RecordCount reflects the complete, unfiltered result set. While you only iterate through the bounded rows, the entire dataset has been downloaded to the client memory.RecordCount typically reflects only the bounded count (or returns -1 depending on the driver's cursor implementation), as the server only transmitted the requested slice of data.Server-side execution is generally guaranteed when using modern RAD Studio versions (10.4 Sydney and later) paired with servers that support native pagination syntax. Common supported combinations include:
| Database | Minimum Version for Native Support | SQL Syntax Used |
|---|---|---|
| PostgreSQL / MySQL / SQLite | Most versions | LIMIT / OFFSET |
| SQL Server | 2012 (11.x) or later | OFFSET / FETCH NEXT |
| Oracle | 12c (12.1) or later | OFFSET / FETCH NEXT |
| Firebird | 3.0 or later | ROWS / FETCH |
Because the fallback is silent, you must verify the actual SQL being executed. Use these steps to confirm server-side pagination:
TFDMoniRemoteClientLink or TFDMoniFlatFileClientLink. This allows you to inspect the raw SQL string sent to the server. If you do not see LIMIT, OFFSET, or FETCH in the monitor, pagination is happening on the client.FDConnection.GetInfo.Limit. A spike in memory indicates a client-side fallback.Diagnostic Detail Needed: To provide a more specific recommendation, please specify the exact version of your database server (e.g., SQL Server 2008 vs 2016) and the RAD Studio version you are using.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.