Porting the next beast... (query generation / execution utils)