todo Pre-compute foreign keys, attributes and join types (forward-ref or backref) in the AggregateQueryResultWrapper.iterate method. Improve the performance of the QueryCompiler.