Initialize MySQL query for locality.