The optimal reactive power compensation problem in a distribution network is studied. Based on the actual characteristics of the distribution network, this paper proposes an adaptive energy loss evaluation formula for the electrical network with various measurement configurations. On this basis, a mathematical optimization model for the reactive power compensation in the distribution network is presented, in which the computing effort required in solving such a dynamic optimization problem is greatly decreased with appropriate linearization and stepwise correction. A case study on an IEEE 69-bus system has verified the rationality and validity of the proposed strategy, showing that the approach has substantially reduced the computational expense while maintaining a high level of accuracy.