As TP has said, shoaling/schooling is a defensive behaviour. In small crowded tanks, it is rarely seen. It is best observed in large tanks, with open spaces, and very low stocking levels. When the schooling fish venture into the open, they stick close together.