I get the same script time results with this two different query : FIRST : {set $articles_count=$category.subtree[$category.subtree|count()|sub(1)].object.class_identifier|eq(article)} SECOND : {set $articles_count=fetch(content, list_count, hash('parent_node_id', $category.node_id, 'class_filter_type', 'include', 'class_filter_array', array('article'), 'depth_operator', '>', 'depth', 0 )) }