Both, although longer subs may depend on the camera and the skies. Beginners rarely get enough data in general anyway, so more data, longer exposures, longer integrations in general should be the rule of thumb. When a beginner gets their first 10 hour integration, I'm usually pretty proud. It's a big milestone. Then there are 20, 30, 50 hour integrations... Then there are the multi-year long APOD projects and multi-panel mosaics and stuff to explore. ;D
Anyway. More integration, pretty much always. Two hours? Drop in the bucket. Four hours? Good start for a beginner. Eight hours? Ok, beginner is starting to push it. Ten hours? Key milestone, beginner is probably entering intermediate territory now. Twenty, thirty, fifty hours and beyond? Excellent!
As for exposure length. I like to explain it this way. There are two competing forces that determine sub-exposure length: Stellar clipping and read noise.
1) Clipping is the force that makes you want to use shorter exposures. It determines how long you CAN expose for.
2) Read noise is the force that makes you want to use longer exposures. It determines how long you MUST expose for, at a minimum.
You need to expose long enough to sufficiently swamp the read noise, but not so long that you are clipping too much signal. A few stars clipped (10, 20, maybe 30 - lightly) is usually fine. Most stars clipped? Probably exposing too long. On the flip side, if you are seeing banding, or other structures, medium and large scale blotching, etc. in your background? You are probably not exposing long enough.
General rule of thumb is expose as long as you can, until you start to feel you are clipping too many stars. Then back off just slightly. Check the background noise. If the background generally looks clean and you aren't clipping tons of stars, then you are probably fine. If you are not clipping anything? Well, if you are ABLE to expose longer, you might as well expose longer. Longer sub-exposures tend to be better, and even if you reach the effective limits (i.e. your shot noise so completely overpowers read noise that read noise becomes meaningless), if you are not clipping anything then there is no harm done.
There is more to exposure than just this. But, as a beginner, this should do. Once you get into asking questions like how you optimize resolution and get the most detail, then you might want to start thinking about optimizing sub-exposure length more.