A fast algorithm for query optimization in universal-relation databases