I have a user table and a location table. A user can visit many locations and locations can be visited by many users.
I want to return results, ordered by distance, of the nearest locations that a user has not visited.
So many problems arise here. Join tables cannot be used, as results will return a maximum of 1000 rows. This means that it is not possible to do a select on the Locations and join tables and guarantee all matching results are excluded. i.e. I cannot use whereNotContainedIn due to the 1000 row limit.
I cannot use Relations as they also suffer the same 1000 row limit, so cannot guarantee accurate results.
I could use Pointers or an Array. Pointers are meant for one to one relationships, so there is no simple way to append to a list of pointers. Arrays are memory heavy and not meant to spill over 100 entries ideally, so Im not sure which is the best option.
Has anyone had to make this kind of query before?