Finite difference approximation, in addition to Taylor truncation errors, introduces numerical dispersion-and-dissipation errors into numerical solutions of partial differential equations. We analyze a class of finite difference schemes which are designed to minimize these errors (at the expense of formal order of accuracy), and we analyze the interplay between the Taylor truncation errors and the dispersion-and-dissipation errors during mesh refinement. In particular, we study the numerical dispersion relation of the fully discretized non-dispersive transport equation in one and two space dimensions. We derive the numerical phase error and the L 2 -norm error of the solution in terms of the dispersion-and-dissipation error. Based on our analysis, we investigate the error dynamics among various optimized compact schemes and the unoptimized higher-order generalized Padé compact schemes, taking into account four important factors, namely, (i) error tolerance, (ii) computer memory capacity, (iii) resolvable wavenumber, and (iv) CPU/GPU time. The dynamics shed light on the principles of designing suitable optimized compact schemes for a given problem. Using these principles as guidelines, we then propose an optimized scheme that prescribes the numerical dispersion relation before finding the corresponding discretization. This approach produces smaller numerical dispersion-and-dissipation errors for linear and nonlinear problems, compared with the unoptimized higher-order compact schemes and other optimized schemes developed in the literature. Finally, we discuss the difficulty of developing an optimized composite boundary scheme for problems with non-trivial boundary conditions. We propose a composite scheme that introduces a buffer zone to connect an optimized interior scheme and an unoptimized boundary scheme. Our numerical experiments show that this strategy produces small L 2 -norm error when a wave packet passes through the non-periodic boundary.