The aim of this research is to integrate various Bayesian network (BN) inference algorithms into a framework based on Bayesian methods to solving the "algorithm selection problem" of real-time BN inference. The metareasoner is a Bayesian network that encodes the uncertain knowledge of dependencies among the characteristics of BN inference problem instances and the performance of the inference algorithms. It is automatically learned from some representative synthetic training data with the guidance of some domain nowledge. Once having this metareasoner network, we can then use it to select the right algorithm for a given Bayesian network inference problem instance and predict the run time performance of the algorithm on this problem instance. Such methods will also be useful in solving other hard problems.