Oxygen: dissolved oxygen
Levels of dissolved oxygen, essential for aquatic life, depend in part on water temperature and the equalizing effects of surface currents; and in part on the oxygen demand of the bioload, that is, of all the oxygen-respiring organisms in the system, from fish to microbes.
Temperature. There is a direct correlation between temperature and the level of any gas saturation in water. For oxygen in fresh water the range is from 14.2 mg/l or ppm at 1°C, dropping to 8.4mg/l at 25°C, to 7.7 mg/l at 30°C, and 7.1mg/l at 35°C. You'll find various quite similar tables of these values by googling "dissolved+oxygen temperature table". At any rate, you understand even without a table that tropically warm waters are saturated with dissolved oxygen at much lower levels than chilly temperate waters. Fishes are evolutionarily adapted to certain oxygen levels and cannot be acclimated to lower ones: your hillstream loach, which came from the cool waters of rapidly-moving streams, will show respiratory distress long before your gouramis will. As water temperatures rise, all metabolisms increase, both the metabolism of fish and the metabolism of the aquarium's bacteria, and so do their needs for oxygen.
There are other variables that affect the actual amount of dissolved oxygen. Dissolved salts also reduce the oxygen carrying capacity of water, and altitude affects the partial pressure of dissolved oxygen at all temperatures.
Biological oxygen demand (BOD). But a much more important variable is biological oxygen demand (BOD). BOD represents the combined demand of all the aerobic metabolisms at work in the water, not merely that of the fishes and microscopic plankton, but also of the aerobic bacterial community. Actually calibrating BOD is a task best left to laboratory ecologists. But the concept is important to keep in mind, because it's all too easy to underestimate the "bioload" in an aquarium by merely correlating it with the number of fish you're maintaining and their combined mass. Keep in mind that the invisible processes of aerobic decomposition of organic material are also part of the BOD or "bioload." The metabolism involved in decomposition requires oxygen— in fact it needs even more oxygen than familiar respiration does. This is why water high in decaying organic material is characteristically also low in oxygen. Think of stagnant swamp water.
The quite different metabolic chemistry by which an entirely different group of bacteria break down ammonia also requires elevated oxygen levels. Plants that aren't getting enough light to be actively photosynthesizing make their own contribution to BOD. We tend to ignore the constant respiration of algae and plants, because photosynthesis produces such vast quantities of oxygen as a by-product that it swamps the effects of cellular respiration— except at night. But algae and plants are constantly respiring at the cellular level, night and day. Oxygen is essential for plants as well as fish.
"Oxygenating." A couple of generations ago, aquarium plants were judged as "oxygenators." In actual fact, the dissolved oxygen content of water derives from atmospheric O2 diffused at the surface and from the temperature as much as from the oxygen delivered by active plants. Spurious techniques for "supplementing" oxygen surface in the hobby from time to time. Sometimes they involve hydrogen peroxide. Chemical "oxygenators" are not a genuine option— even if you do see some "oxygenating" novelties at your otherwise-reputable LFS.
"Oxygen starvation." Fish gasping at the water surface and showing other symptoms of respiratory distress are unlikely to be suffering from low oxygen levels and more likely to be stressed by high levels of carbon dioxide in the water. Without a sharp gradient between CO2 levels in the blood and CO2 levels in the water, it becomes increasingly difficult for them to diffuse the CO2 out of their blood across their gill surfaces.
Without filtration and recirculation, the water in your aquarium could easily become stagnant, and it's always somewhat polluted ("eutrophic" is the eco-euphemism) from the metabolisms of the fishes and all the organisms involved in biodegrading fish excreta. "Deteriorating water quality," is the colorless and unhelpful phrase you hear for this. What's happening is that the BOD ("biological oxygen demand") rises, and so does the CO2 in the water. Under sufficient light strongly growing plants will take this up as rapidly as it's formed, and CO2 injection is a prominent feature of high-tech planted aquaria. But in plantless tanks with rising levels of CO2 the fish are less able to diffuse the CO2 in their blood across the gill surfaces, so eventually they rise and hang at the water surface gasping the surface layer rich in atmospheric oxygen. This should never ever happen to your fish, because the symptoms of their distress should never become so extreme. When fishes rise to the surface, an immediate partial water change is urgent, and additional water current at the surface is needed to drive off CO2 into the atmosphere. An air hose and diffuser might help in such an emergency. In a tank with a tightly-fitting glass cover, condensation can seal the narrow crevice between a glass pane and the tank frame. In low light, if carbon dioxide levels build up in the stagnant airspace, corresponding dissolved CO2 levels in the water can rise, and the fish may have difficulty eliminating CO2, and in an extreme situation they may come gasping to the surface. The remedy is the same: an air pump will drive out surplus gases from under a close-fitting glass cover.
By the way, if fish are respiring heavily, it's also quite possible that they are suffering more from nitrite poisoning than from low oxygen levels. Nitrite in the water is drawn across the gill surfaces and occupies the sites on the blood's hemoglobin molecule that would ordinarily be transporting oxygen. The result is that the fish respire with effort. Barbs struggling with nitrite tend to tip their snouts down. Even high levels of the less toxic nitrate may elicit signs of stress, such as stereotyped behavior.
Supersaturation. On the other hand, if it were possible, water that was supersaturated with O2 could also be harmful: oxygen is a powerful reagent. An overdose of hydrogen peroxide, for example, could temporarily supersaturate the water.
