A lot of findings show that moderate drinkers' cognitive function beats that of both teetotalers and heavy drinkers. The whole thread is about moderate drinking.
At least, it does not make things worse.
E.g. N Engl J Med. 2005 Jan 20;352(3):245-53.: conclusion "Our data suggest that in women, up to one drink per day does not impair cognitive function and may actually decrease the risk of cognitive decline."
The thing about teetotalers is that they are more often than not former alcoholics because most people who can handle drinking responsibly do so and do not need full abstinence. Non-alcoholic full abstinence due to preferences (my late maternal grandma just did not like it at all in any form) is relatively rare. Therefore, it could be that relatively poorer cognitive function of full abstainers reflects past damage from heavy consumption of alcohol, which should be taken into account when interpreting the data.
So it is a U curve. That is the most important thing.
It is the same with overall mortality: light to moderate drinking is best, better than full abstinence and heavy drinking.
http://www.ncbi.nlm.nih.gov/pubmed/10606482