Why does alge produce a net loss of oxygen in water?

In discussion of water quality in lakes, I keep hearing that excessive alge is a problem because they use up all the oxygen in the water. But I thought alge used photosynthesis to produce oxygen- why would they leave the water less oxygenated?

Lumpy I just answered a closely related question in some detail in this thread:

It’s probably worth a look. But broadly you’re overlooking two points.
The first point you’re overlooking, and were probably never taught, is that plants photosynthesise and produce oxygen for the sole reason of producing sugars and other foods. They produce those sugars so that they can digest them exactly the same way that animals do. And just as animals produce use oxygen and produce carbon dioxide when they burn food so do plants. Plants are only net oxygen producers when light levels are, which essentially means the middle of the day. As soon as light levels fall below a minimum value the plants start burning up food faster than they can produce it and as a result they start producing oxygen faster than they can produce it. That can be a problem because the food they are burning was accumulated during 8 or more hours of daylight but can be burned mostly during the first few hours of darkness. That can cause a massive depletion of oxygen.
The second point is that the type of algae being discussed in these situations are essentially unicellular organisms. They have a phenomenal growth rate if conditions are right. That is particularly true if the water has been fertilised form runoff of some form. Under those conditions the algae can multiply from a few grams per m^3 to several kgs per m^3. The problem comes because such a rapid growth rate can’t possibly be sustained. Very rapidly the algae use up all the nutrients in the water and die off. And they die off even faster than they multiplied in the first place. That means that literally overnight a lake can be filled with thousands of tonnes of dead and dying plant material. And dead plant material in water rots, and it tends to rot very fast. The process of rotting, or decay, occurs first by very rapid aerobic breakdown. It is essentially just the microbes in the water digesting the plant food as an animal would, and like animals those microbes use up oxygen to do it. Not surprisingly when a small lake has thousands of tonnes of rotting vegetation floating in it the oxygen supply is very rapidly depleted.

If you want a search term for further research: “eutrophication”. Excessive algal growth is especially a problem in lakes polluted with phosphorous compounds (such as the phosphates formerly used in many detergents and still used in some). Phosphorous is a limiting resource in many lakes (and on land) and excess phosphorous greatly increases the growth rate of otherwise-limited organisms such as algae which can grow very quickly if their growth is not limited by phosphorous. In the oceans, iron is often a limiting resource, though it’s unlikely that humans could ever add enough iron to the oceans to cause eutrophication. In fact, adding iron to ocean water has been shown to reduce CO[sub]2[/sub] in the area above that water, by encouraging the growth of photosynthetic phytoplankton. The phenomenon found in eutrophication – net loss of oxygen – doesn’t occur in this case.