I am currently trying to get all relationship elements for a single parent by calling:
var items = ApplicationContext.Current.Services.RelationService.GetByParentId(members.GetCurrentMemberId()).ToArray();
Everything works perfectly. Unless I look at the MiniProfiler, I see that it launches two queries for each element, which causes some serious performance problems with a lot of elements.

I looked at the UmbracoCMS code and I found this piece of code:
protected override IEnumerable<IRelation> PerformGetByQuery(IQuery<IRelation> query)
{
var sqlClause = GetBaseQuery(false);
var translator = new SqlTranslator<IRelation>(sqlClause, query);
var sql = translator.Translate();
var dtos = Database.Fetch<RelationDto>(sql);
foreach (var dto in dtos)
{
yield return Get(dto.Id);
}
}
Preview in dtossends a request for each MoveNext()to the table umbracoRelationType. The method Get()actually queries a single item from the table umbracoRelation. I think he should use the cache there, but apparently this is not so.
. ? - Umbraco?
Umbraco 7.2.6