For primary dominant 7th, extend dominant 7th or secondary dominant 7th that resolves to a major chord, From the 5th of the chord, continuously go up a perfect fifth, each time we’ll get an available tension for the Dominant 7th chord. Relatively, we’ll get 9, 13, 3rd. In the examples below, we are using all fourths tuning.
We can see it forms a perfect diagonal line. When combining multiple diagonal lines of this, we’ll have the shape below. All notes are chord tones and available tensions.
The above pattern is 3 octaves of the major pentatonic scale shape.
For altered dominant 7th chord, From the b5 of the chord, go up a perfect 5th each time and we’ll get b9, b13 and #9. Go up a perfect 5th one more time and we’ll get b7
If we map out all these notes to the fretboard, we’ll start to see a pattern
So you can play major pentatonic scale from the b5 or minor pentatonic scale from the #9. Pentatonic scales are super simple to be visualized on all fourths tuning system. If you don’t know how yet, please review it here
The reason behind this is the overtone series. According to the overtone series, the closest harmonic relationship to the root is the 5th above it.