index and join performance optimisation