An example of a study on this
https://pmc.ncbi.nlm.nih.gov/articles/PMC4892924/
Notes
CO2 builds up when people are indoors. It is very easy for an amount of CO2 to build up that would affect your cognitive performance or how well you think. The normal outside air is around or below 400 PPM (parts per million) CO2. Indoors, the CO2 in your home or office can get much higher than that. Once you get up to 1400 PPM, your cognitive performance on complex and difficult mental tasks can be just about cut in half.
One solution to the problem is to install an ERV (Energy Recovery Ventilator) on your home. This will basically exchange the air inside with outside air while also using the inside air that it is about to send out to cool or heat the incoming fresh air so that you don’t spend a lot of money on wasted energy heating or cooling the new fresh air. Another solution is to open windows, but that is hard to do sometimes when it is super hot or super cool outside.