history db nearly built from hist table