Depends on the pet for sure.
We have 2 dogs that are inside/outside and won't try to escape at all, in a fence or deck they'll stay... our other dog (outside/guardian) will dig under fence, she'll poke her head through every hoel to find an escape, even 4" field fence trying to climb through she even will bite and pull on the fence and try to 'move it'. I had some wood fencing blocking holes and she would grab it and drag it away to escape.
I ended up connecting the bottoms of the fence to the ground (spikes) so she can't pull it up or flex it, and also tightened the top line.
Going forward we're using 4' instead of 6' field fence and got the heavy duty high tensile fence this time... 4' will work as long as they can't climb onto something and get 'over'... 6' better for deer but 2-3x more $$ and we're only trying to do another 1k ft or so, already put up about 900 just for garden and chicken area.
I looked into electrical, too much work and too many issues to make it as effective as a good fence. I would also use the buried invisible fence for our inside dogs, my outside dog would just walk through it get shocked then run and hide far away based on my exp. with her and vibrate/beep collars too.