It is not necessary to use oil to cook pasta, as pasta will not stick together if the water is at a rolling boil and has enough salt. Using oil can cause the pasta to become greasy and prevent it from absorbing the sauce. However, some people like to add a small amount of oil to pasta water to prevent foaming.