Skip to content

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

Open
@aarontravass

Description

@aarontravass

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/paginatorfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions