BigW Consortium Gitlab
Postgres and MySQL don't guarantee that pagination with `LIMIT` and `OFFSET` will work if the ordering isn't unique. From the Postgres docs: > When using `LIMIT`, it is important to use an `ORDER BY` clause that > constrains the result rows into a unique order. Otherwise you will get > an unpredictable subset of the query's rows Before: [1] pry(main)> issues = 1.upto(Issue.count).map { |i| Issue.sort('priority').page(i).per(1).map(&:id) }.flatten [2] pry(main)> issues.count => 81 [3] pry(main)> issues.uniq.count => 42 After: [1] pry(main)> issues = 1.upto(Issue.count).map { |i| Issue.sort('priority').page(i).per(1).map(&:id) }.flatten [2] pry(main)> issues.count => 81 [3] pry(main)> issues.uniq.count => 81
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
access_requestable.rb | Loading commit data... | |
awardable.rb | Loading commit data... | |
case_sensitivity.rb | Loading commit data... | |
importable.rb | Loading commit data... | |
internal_id.rb | Loading commit data... | |
issuable.rb | Loading commit data... | |
mentionable.rb | Loading commit data... | |
milestoneish.rb | Loading commit data... | |
participable.rb | Loading commit data... | |
referable.rb | Loading commit data... | |
sortable.rb | Loading commit data... | |
statuseable.rb | Loading commit data... | |
strip_attribute.rb | Loading commit data... | |
subscribable.rb | Loading commit data... | |
taskable.rb | Loading commit data... | |
token_authenticatable.rb | Loading commit data... |