The Flamenco system is a web search interface that allows users to browse through large data sets using predefined hierarchical faceted metadata. It is built on top of a conventional relational database and currently scales to collections of several tens of thousands of items. In the current implementation, the system translates each user query into multiple SQL group-by commands in order to obtain query preview information for possible future queries. These group-by's take up a significant fraction of the query processing time. In this note, we describe an optimization that allows us to speed up the group-by computations dramatically. Our ideas have some similarity to the work of Beyer and Ramakrishnan on computing iceberg data cubes.