Mg2+ and o2- have higher charges than Na+ and Cl-. As such, the electrostatic forces of attraction between Mg2+ and O2- are stronger than that between Na+ and Cl-. Thus, more energy is absorbed to overcome the stronger forces of attraction in MgO than NaCl