Memory optimisation for indexing