In general what you are talking about is interval training. Periods of relatively low to moderate effort mixed with periods of high to very high effort. I think it's good to do that on a regular basis.
To some extent your terrain might force you to do it. Terrain that is constantly rolling up or down will give you some of what interval training does automatically without you even having to plan it. For parts where the terrain is flat, I suppose you might have to plan it, otherwise you get in a rut and never think to try to do better.
So what ever works for you.
If you ever get knee pain on your bike, then likely you are using too high a gear ratio. Pedaling should be stupidly easy most of the time. Especially if you have knee issues.