Analogous to cdb, but faster