Performance: prepare queries only once