Efficient Learning Algorithms for Distributed Databases