Optimize query in "label" view