Many performance tweaks ans use of hashjoins