The influence factor of filaments consisted of oxygen vacancies (VOs) is important for resistive switching. In this paper, the interaction between VOs in MgO and its influence on VO-filaments are studied using density functional theory. It reveals that the VOs in MgO tend to be aggregation state. The distribution of energy level for VO pair in band gap changes with different configurations. The interaction between VO chains also results in their aggregation state in MgO insulator. The calculation results show that with the diameter of filament increasing, the formation energy per VO decreases and the filaments presents semiconductor-metal transition. Based on these calculation results, the set process of MgO based resistive switching is discussed.