Sandy bottoms are beneficial to goldfish in several ways. As enrichment, they love to dig in looking for food and when bottom feeding the sand give as they go for the food instead of bouncing off the glass. It acts as ball bearings or a bumper between the fish and the glass. As they forage, even between feedings they love passing the sand through their gill rackers and digestive track with food where it acts as grit or fiber to keep their gut moving. A happy healthy moving goldfish gut is the best way to prevent swim bladder issues.
A little sand goes a long way. For a 6 foot tank a gallon or less of sand is usually good. My centralized water flow usually blows areas bare, causing drifts in the lower flow areas where I feed sinking Hikari Lionhead and Saki Goldfish. I use fine beach sand from the coast of Oregon which is mainly silica/quartz and or Aragamax oolitic aragonite from caribsea. The oolitic aragonite is form or calcium carbonate that dissolve readily increasing your pH, kH and GH. It starts dissolving below 8.2 and is one of the best buffers available providing both calcium and carbonate freely in the water.