Improved db performance for chat loading