cdb: add index and merge functionality