Ovulation Day

Hello! I'm confused as to whether you are supposed to have sex before you ovulate or on the day of? My doctor told me that the sperm needs to be "mature" for you to get pregnant but I can't remember if he said to have sex on the day of. Or before. Thanks!