Disable count to improve performance on large dataset #172
-
Hi, I have a complex data structure on a large data set, and I would like to disable the count() query for optimization. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @asafhbinov, public static QueryablePaging<T> GridifyQueryable<T>(this IQueryable<T> query, IGridifyQuery? gridifyQuery, IGridifyMapper<T>? mapper = null)
{
query = query.ApplyFiltering(gridifyQuery, mapper);
var count = query.Count();
query = query.ApplyOrdering(gridifyQuery, mapper);
query = query.ApplyPaging(gridifyQuery);
return new QueryablePaging<T>(count, query);
} You have complete control over each operation within Gridify. You can create your own extension to bypass the counting process, or you can opt to use the public static IQueryable<T> ApplyFilteringOrderingPaging<T>(this IQueryable<T> query, IGridifyQuery? gridifyQuery,
IGridifyMapper<T>? mapper = null)
{
if (gridifyQuery == null) return query;
query = query.ApplyFiltering(gridifyQuery, mapper);
query = query.ApplyOrdering(gridifyQuery, mapper);
query = query.ApplyPaging(gridifyQuery);
return query;
} |
Beta Was this translation helpful? Give feedback.
Hi @asafhbinov,
if you check the
GridifyQueryable
method, it essentially applies filtering, retrieves the count, and then ordering and paging sequentially.You have complete control over each operation within Gridify. You can create your own extension to bypass the counting process, or you can o…