Reverting last commit and making heavy query on SQLite heavier