Data structure for database query optimization at the expense of write and storage to maintain the index structure