Elixir Pagination Metadata

What are the possible reasons that result in total_count_cap_exceeded field returning true in Pagination.Page.Metadata?

I was supposed to get 2000 for total_count field but it kept showing 10000 which resulted in total_count_cap_exceeded returning true value.
Then after reseting the db and seeding data, it returned total_count of 2000 and false value for total_count_cap_exceeded. But how/why does resetting db and seeding again make this change?

Metadata

Maybe you ran seeds five times? Or ran a query which does joining which quintuplicates # of rows?

My first guess was that paginator uses count esitamates and those can get out of sync with real counts when tables are not vacuumed regularly. But looking at the code they do actually run count with limit = total_count + 1 which means postgres actually counts the rows returned by the subquery up to the limit – see ’ Answer to actual question’ section.