Implementing Data Cubes Efficiently