Caching of PHQL planning