Prepare caching tree-relations in DB