attempted some db optimizations for markov