OK, in that specific example, we've got ~500 SPRs being instantiated just to get their id's for the in-clause of the next sql query. So I can do one really simple fix for the moment, that will not instantiate the SPRs but rather just get a list of ids (I'm guessing this is why the query *appears* to take so long - the object instantiation - but I'll verify that with cprov later).
It would still be good to find out why this query is being run 5 times... if it's worthwhile, I can continue looking into that as well.
OK, in that specific example, we've got ~500 SPRs being instantiated just to get their id's for the in-clause of the next sql query. So I can do one really simple fix for the moment, that will not instantiate the SPRs but rather just get a list of ids (I'm guessing this is why the query *appears* to take so long - the object instantiation - but I'll verify that with cprov later).
It would still be good to find out why this query is being run 5 times... if it's worthwhile, I can continue looking into that as well.