Skip to content

Commit

Permalink
Fix pagination for toprefs
Browse files Browse the repository at this point in the history
When excluding the own domains, the CTE would select + offset, and then
the outer would select + limit, but if some entries were filtered
that's not correct: move the offset to outer instead.
  • Loading branch information
arp242 committed Apr 10, 2024
1 parent 27b1bfe commit 84cec37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/query/ref.ListTopRefs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ with x as (
order by count desc, ref_id
-- Over-select quite a bit here since we may filter on the refs.ref below;
-- even with the over-select a CTE is quite a bit faster.
limit :limit2 offset :offset
limit :limit2
)
select
x.count,
Expand All @@ -19,4 +19,4 @@ select
from x
left join refs using (ref_id)
{{:has_domain where refs.ref not like :ref}}
limit :limit
limit :limit offset :offset

0 comments on commit 84cec37

Please sign in to comment.