Sorting and filtering on the server and client

dbForge Studio for SQL Server automatically performs data sorting and filtering on either the client side or server side, depending on the number of records.

When a table contains a small number of records, all data is retrieved and displayed in the results grid. In this case, sorting and filtering are performed on the client side using the data already loaded into the grid.

However, if a table contains a large number of records, only a portion of the data is loaded initially. This limitation helps prevent performance degradation or freezes on the client machine when processing large volumes of data.

When paged mode is enabled and the total number of records exceeds the number shown on a single page, only a subset of records is displayed in the grid. If sorting or filtering were performed on the client side, only the records currently available on the client would be processed, which could lead to incomplete or inaccurate results. To prevent this, the tool automatically switches to server-side sorting or filtering when not all records are loaded into the grid.

When server-side sorting or filtering is performed, the application sends a modified version of the query to the server. Although this approach uses server resources, it ensures that the user receives a complete and accurate result.

However, once all records are loaded (for example, after pressing Ctrl+End or scrolling to the end of the grid), the application switches from server-side to client-side sorting or filtering.

Issues that may occur during server-side sorting or filtering

In the following cases, the application cannot modify the input query and send it to the server to perform server-side sorting or filtering:

  • An expression without an alias in the SELECT statement – This is a limitation of SQL Server - queries that contain expressions without aliases in the SELECT statement cannot be modified for server-side operations. If a column lacks an alias, sorting or filtering on any column is disabled until all data is fetched or aliases are defined.

  • A query contains an ORDER BY clause – Server-side filtering is not possible due to another SQL Server restriction.