change delete old post query and optimize that