Histogram-based Compression of Databases and Data Cubes