I’m using a MudBlazor DataGrid to display records from a SQL server, which I am accessing via Entity Framework. The table I’m querying might contain anywhere from several thousand to several million records.
On small test data sets, the DataGrid performs just fine, however when I connect it to production-scale test data, the performance becomes extremely slow, taking roughly the same time a SELECT * FROM MyTable
takes on the SQL server to load or change pages. The UI on the client side also becomes terribly slow (which suggests to me that the server may be transmitting a lot of data to the client and using up lots of memory).
My DataGrid looks as follows:
<MudDataGrid Items="MyContext.MyTable"
FixedHeader="true" FixedFooter="true" Hover="true"
SortMode="SortMode.Single" Filterable="true"
FilterMode="DataGridFilterMode.ColumnFilterMenu"
RowClick="NavigateToWork" T="IMyRecord" Hideable="true"
FilterCaseSensitivity="DataGridFilterCaseSensitivity.CaseInsensitive"
DragDropColumnReordering="true" ColumnsPanelReordering="true"
ColumnResizeMode="ResizeMode.Column"
ShowMenuIcon="true">
<Columns>
<PropertyColumn Property="@(x => x.Id)" />
@* etc *@
</Columns>
<PagerContent>
<MudDataGridPager T="IMyRecord" />
</PagerContent>
</MudDataGrid>
Is there something I’m missing to specify that it shouldn’t load the whole table, or does the DataGrid internally use AsEnumerable
or ToList
on the IQueryable
I pass to it and force the download somewhere beyond my control?