Tree query plan pattern