Completed
Last Updated: 19 Feb 2020 14:48 by ADMIN
Release 2.8.0
Wietze
Created on: 14 Feb 2020 12:32
Category: Grid
Type: Bug Report
0
In the grid in version 2.7.1 the select statement with paging does not contain a top x.
When using IQueryable as data source in the blazor grid with paging in version 2.7.1 the resulting EF query does not contain a top x. So all records are retrieved. In version 2.7.0 it seems to work correctly.
6 comments
Wietze
Posted on: 18 Feb 2020 12:14

Hi Marin,

Thank you. I'm looking forward to the next release.

Regards,

Wietze

ADMIN
Marin Bratanov
Posted on: 18 Feb 2020 12:12

Hi Wietze,

My apologies for misunderstanding the scenario and closing this, I was wrong. Thank you for following up and pointing out the issue.

Indeed, we have reproduced this, and it is under development right now. We will have it fixed for our next release (hopefully, by the end of the week).

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Wietze
Posted on: 18 Feb 2020 06:41

Hi Marin,

Thanks for your answer, but I disagree. The nice thing about Blazor Server is that you can provide an IQueryable as the datasource and the grid handles all the data retreival and paging etc. If you were right, how would you explain the difference between version 2.7.0 (and previous) and 2.7.1? If I use 2.7.0 I get two queries (count and top <pagelength>). If I use 2.7.1 without changing anything else, I get an extra query that gets all the records. If you've got 100.000 plus records, like I somtimes get in my application, the performance takes a big hit.

The standard FetchData page has no paging and does a foreach over the datasource, so the queries it produces are different.

Regards,

Wietze

ADMIN
Marin Bratanov
Posted on: 17 Feb 2020 16:33

Hi Wietze,

The grid does not request the data from the service, and it cannot control what query will be generated. Can you confirm whether using the standard FetchData page (where a simple <table> is used) has different behavior?

Generally, the grid works with the data the developer provides in the view-model through its Data parameter, and it is up to the application to fetch that data in the most efficient manner. For example, you could use a variable for the page size and pass that along to the service so it only gets the Top N records initially.

You can take this a step further by extracting the grid state (page size, current page, filters, sorts) through the OnRead event and passing those parameters to your service so you can optimize the queries there and only return the total count and the current page of data: https://docs.telerik.com/blazor-ui/components/grid/manual-operations.

With this in mind, this cannot be a bug in the grid since the grid is not involved in this data retrieval process.

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Wietze
Posted on: 17 Feb 2020 14:43

Hi Marin,

Included you find an example that uses SQL Server. After creating the database, you have to add some records manually.

What I found is that in version 2.7.0 two queries are executed initially:

SELECT COUNT(*)
FROM [WeatherForecasts] AS [w]

SELECT [w].[ID], [w].[Date], [w].[Summary], [w].[TemperatureC]
FROM [WeatherForecasts] AS [w]
ORDER BY (SELECT 1)
OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY

In version 2.7.1 this query is executed before these queries:

SELECT [w].[ID], [w].[Date], [w].[Summary], [w].[TemperatureC]
FROM [WeatherForecasts] AS [w]

This query fetches all records and with many records that can take a while. When selecting a different page this query is not repeated.

Regards,
Wietze

ADMIN
Marin Bratanov
Posted on: 14 Feb 2020 13:07

Hi Wietze,

Please send me a simple runnable example that showcases this so we can have a look.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor