Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(paginator): Paginator option where total length of the dataset of unknown #28978

Open
aarontravass opened this issue Apr 29, 2024 · 0 comments
Labels
area: material/paginator feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions

Comments

@aarontravass
Copy link

Feature Description

The current paginator requires that the length property be set but unfortunately, not all data sources out there can give the total length of the dataset or even if they do give, the fundamental act of running count can be rather slow. I would like to have an option infiniteScroll or another, with a better name, which when set, would emit the next page or previous page events until the data-source returns an empty set, thus letting the user know that they have reached the end of the dataset.

Use Case

The total count of a table is normally found by counting all rows in relational dbs like PostgreSQL

However both both forms of count(1) and count(*) are fundamentally slow. PostgreSQL uses multiversion concurrency control (MVCC) to ensure consistency between simultaneous transactions. This means each transaction may see different rows -- and different numbers of rows -- in a table. There is no single universal row count that the database could cache, so it must scan through all rows counting how many are visible. Performance for an exact count grows linearly with table size.

Moreover, the resulting count is even slower when filters are applied. Filters are the expected part of any data table.

With an infinite scroll option, the user can keep firing the next page event without having to bog down the db with an expensive count query at the start.

@aarontravass aarontravass added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Apr 29, 2024
@amysorto amysorto added P4 A relatively minor issue that is not relevant to core functions area: material/paginator and removed needs triage This issue needs to be triaged by the team labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/paginator feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

2 participants