Bayesian network structure learning based on dynamic programming strategy can be used to find the optimal graph structure compared with approximate search methods. The traditional dynamic programming method for Bayesian network structure learning is a depth-first-based strategy, which is inefficient. We proposed two methods to solve this problem. First, the dependency constraints were used to prune the process of calculating redundancy scores. The constraints were obtained by the conditional independence test from the observed data sets. However, it was difficult to guarantee the accuracy of the constraints, which may have led to a decrease in the accuracy of the method. Second, we proposed a breadth-first-based strategy, which enhanced efficiency greatly while also ensuring global optimality. Experimental results showed that on the standard network data sets, compared with the dynamic programming based on depth-first search (DFSDP) algorithm, dynamic programming based on constraints (CBDP) could reduce the average running time by 57.10% and that dynamic programming based on breadth-first search (BFSDP) could reduce the average running time by 50.02%. On the UCI data sets, compared with DFSDP, CBDP reduced the average running time by 40.71%, and BFSDP reduced the average running time by 81.78%.