db optimising, indexes