Inference as a data management problem