Interfacing Relational Databases and Prolog Efficiently