mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
3.91k stars 1.19k forks source link

[data grid] Handle 1m records #240

Open oliviertassinari opened 3 years ago

oliviertassinari commented 3 years ago

I have been wondering about this aspect. I believe the limitation for displaying, say 1m records is the number of pixels the browser accepts. This is discussed in https://github.com/bvaughn/react-virtualized/issues/396 and https://github.com/WICG/display-locking/issues/49.

How about we automatically trigger the pagination if a user exceeds this limit? It would also be great to document it.

Another thought, in such a case, the server might not even know how many rows they are. With PostgreSQL a simple count(*) on a table with many rows can be too time-consuming to be used in production. We would need to handle this case, the case where the total number of rows is unknown.

Proof: https://codesandbox.io/s/beautiful-silence-1yifo?file=/src/App.js

We document the limitation at: https://material-ui.com/components/data-grid/virtualization/.

Benchmark

mak-elena commented 3 years ago

I'm currently testing DataGrid component and huge data sets (without pagination) are exacly the case I'm interested in. In this regard: Do you consider to implement a behavior similar to react-virtualized/InfiniteLoader?

Or alternatively: The ColumnApi has the method getVisibleColumns (BTW, it returns always all the columns. Is it still under implementation? ) Is it possible to have a similar method for rows? So that prefetching and caching of data requred for rendering can be implemented on top of it.

Thanks.

oliviertassinari commented 3 years ago

@mak-elena We definitely plan to introduce lazy loading for the rows. Right now the only alternative I'm aware of is to set pagination={true}. This new data fetch API will support sorting, filtering, search, grouping, etc.

oliviertassinari commented 3 years ago

It would also be great to document it.

Done in https://material-ui.com/components/data-grid/rendering/#virtualization

Browsers set a limit on the number of pixels a scroll container can host: 17.5 million pixels on Firefox, 33.5 million pixels on Chrome, Edge, and Safari. A reproduction.

oliviertassinari commented 3 years ago

@mak-elena You can track and upvote #404.