Code query db improvements