That depends on the goal for the exercise being done.
For Hypertrophy (increasing muscle mass) shorter rests of 1-2 minutes create more anabolic response. We would usually pair this with sets of 6-12 repetitions with a moderately heavy load.
“Short rest periods of between 1 and 2 minutes cause a greater release of these hormones than longer rest periods” (Kraemer et al, 1991)
If the goal is Strength or power (1-5 repetitions with a heavy load) 3+ minutes will allow a greater amount to be lifted in the subsequent set compared to a shorter rest. This will allow a higher total amount of weight to be lifted (or tonnage) across completed sets.
“Athletes lifted a weight more times in 3 sets after resting 3 minutes compared to when they rested only 1 minute (Kraemer, 1997)”
programmes will include both of the above protocols for different exercises
within them giving you the benefits of both. This is where effective programming comes in.
Timing your rests can also be important to remove another variable from training to know we are actually getting stronger, adapting to imposed demands and progressing.
Kraemer, W. A series of studies-the physiological basis for strength training in American football: fact over philosophy. J. Strength Cond. Res. 11:131-142, 1997
Kraemer, W et al. Endogenous anabolic hormonal and growth factor responses to heavy resistance exercise in males and females. Int. J. Sports Med. 12:228-235, 1991