# Troubleshooting


There has been a single report of a slow last page using very big DB tables. It's a pure DB problem and it's not caused by pagy or by any other ruby code (#696, #704), but a simple pagy override may avoid it:

## override pagy_get_items
def pagy_get_items(collection, pagy)
  limit = pagy.last == pagy.page ? pagy.in : pagy.limit
  collection.offset(pagy.offset).limit(limit)
end