The Short Answer
Rest long enough to perform your next set effectively.
Very short rest is not automatically better.
Heavy Compound Exercises
Often require more recovery between sets.
Isolation Exercises
Often require less.
Why Rest Matters
If you start the next set before recovering enough, your performance may fall.
For muscle growth, strength and quality work matter more than trying to keep rest periods extremely short.
Beginner Rule
If you're unsure, take enough time to feel ready to perform the next set with good technique.