Towards optimal indexing for segment databases