From what I understand, you don’t have a prune routine to delete old entries from your table so it can get really huge, that’s why he suggested to use LIMIT in the query. The way it is it’s fetching all records from your table.
Regarding pagination in custom tables, take a look in the public controller of the messenger.