The Goldfish Sanctuary
The first question you may have is: when is the water too dirty? The short answer is: if you have any doubt, it is probably too dirty. If you casually look at the tank and see food particles or waste in the water, your water is definitely too dirty. If you stir up the gravel and debris appears, your water is too dirty. If it has been weeks since you changed the water, or if you keep your fish in a fishbowl, your water is probably too dirty.
Goldfish produce a lot of ammonia, and because they are large fish, they produce plenty of other waste as well. It is important to keep the water quality in good condition, and this starts with clean water.
Many types of goldfish are strong, but dirty water will eventually kill them as well as make their lives unpleasant. A goldfish can't just leave the tank... if the water is dirty, they must literally live in filth. If conditions are bad enough, goldfish will sometimes try to free themselves by jumping out of the tank to their deaths.
Dirty water holds less oxygen. Ammonia build-up can poison your fish (Goldfish produce a lot of ammonia). Dirty water can weaken your fish, and unseen food particles can nourish colonies of harmful bacteria. Your fish can become more prone to disease.
On the other extreme, there is the tank which is "too clean." If you empty out all of the water and replace it with all new water from the faucet, you can cause other troubles for your fish, including stress because of the change in water quality. This is easy to avoid, however, and is described below.
In order to keep your fish's water cleaner, you should have a filter. It is not essential, but it will save you a lot of work, keep the water cleaner, and is STRONGLY recommended. In a pinch, more frequent partial water changes can take the place of a filter.
Finally, since a small amount of water gets dirtier faster, and because too many partial water changes can be stressful to fish, it is a good idea to get a big tank for your goldfish. The bigger the tank, the better. Two goldfish will outgrow a 10-gallon tank in about a year, and a goldfish will likely die within a year if you keep him in a fishbowl.
Although chemical buildup cannot be prevented, partial water changes are a very effective way to address this problem. Removing uneaten food from a tank is also very helpful.