I am having trouble with the following query taking quite a long time to process when results are large. The limit and offset can change as this is used with pagination. The r