Bunch of db functions, writing rows and the index block to disk