It takes about 30 minutes in the oven for the ricotta filling to heat through, and another 5 minutes to get the cheese on top of spaghetti pie perfectly melted. If you like your spaghetti to be very crunchy on the edges, you can add 5 minutes to the baking time.