There is some important misconceptions in a couple of posts. First on the waste bacteria,
These species of heterotrophic bacteria break down dead organic matter like fish waste, dead fish or plant matter, uneaten fish food, dead bacteria, etc. Some are aerobic, but many species are facultative anaerobes, able to live with or without oxygen. Like all bacteria, they colonize surfaces, and these are most prevalent in the substrate and the filter media. Many species can survive complete drying, allowing them to remain potent even when filter media that has been previously used is completely dry.
These bacteria have only one requirement to appear and live: organics. They compete with autotrophic bacteria for both oxygen and surface area; studies show that even in relatively clean environments, they occupy more than 50% of the available surface area. And given that they can reproduce within 15-60 minutes—compare this to the 12-32 hours required by nitrifying bacteria—you can see how easily these heterotrophic bacteria can overwhelm the system. In a filter, if sludge is allowed to increase, heterotrophic bacteria will multiply so fast they actually smother and kill the autotrophic nitrifying bacteria.
Heterotrophic bacteria cannot synthesize their own food so they need organic material such as fish waste, dead bacteria, fish and plant matter, etc., and while some are aerobic, many are facultative anaerobes, meaning that they can survive in either the presence or absence of free oxygen. Anaerobes are organisms that do not require free oxygen for growth.
Second, sand is overall the best substrate because it is natural. Substrates in the water courses of South America for example are sand, or a mix of sand and gravel (thse are very, very few), or mulm/dirt/mud with or without sand in the mix. Often covered by leaf litter. All aquarium plants will grow as well in sand as any other substrate, some will weaken in larger gravel. Water does percolate through the sand due to invection currents especially where there are plant roots. And these bring oxygen because during photosynthesis the plant releases excess oxygen as a by-product and it is dispersed mainly through the plant's roots. Snails especially Malaysian Livebearing can also sweeten the sand. The only time sand will be detrimental is if there is too much, overstocking, oveerfeeding, no plants, insufficient water changes with or without a sand vacuum depending. My 5-foot and 3-foot tanks with Corydoras never saw the sand touched by me, and in five-plus years this had no detriment.
Gravel is proven to cause bacterial issues for Corydoras, sand does not all else being equal. Barbel loss is more often due to bacterial issues in gravel than roughness. Anyone wanting to debate this scientific fact, please try your luck disputing this with Ian Fuller, not me.