I recently had to fly from Barcelona via Madrid to Athens. Don't ask my why this routing was chosen, a secretary of the client who paid for the trop did it. Anyway, here's a very valuable piece of advise for all:
My Madrid to Athens flight was on Aegean, a Star Alliance carrier. My Barcelona to Madrid flight was, for cost reasons, on Vueling - owned by IAG and hence a Oneworld carrier. Don't do that!
Oneworld airlines are in Madrid Barajas terminal 4. All others are in terminals 1-3. You cannot change terminals without going landside again. And the bus ride between the terminals is about 10 minutes - and when you arrive at the other terminal, especially if it's the popular terminals 1-3, there is a very long line in front of the security check.
Solution: They should have booked me on Air Europa instead of Vueling to catch my Aegean flight. Air Europa is another low cost airline - but it's member of the Star Alliance and flies into terminals 1-3 in Madrid. You don't have to go through security again. And coincidentally their Barcelona-Madrid flight was at exactly the same time as my Vueling flight.
Side note: At 5'8 I'm too tall for Vueling's seat pitch. But a one-hour flight is just about ok.