In few cases each campaign has relation to almost all locations. So in case we have 10K locations (for provider) and 300 campaign (for the same provider) we will have 3M associations (for the provider).
Locations are lazy loaded and map as sub-select fetch:
So, when campaign.locations (we call to provider.campaigns before so all campaigns were loaded) it will trigger load of all locations, but it loaded them by join with the association table so it mean that the result list is 3M locations + association instead of just load 10K locations and the associations.
The best plan will be to load the associations and than load locations. Is there a way to do this?