We connect and solve two long-standing open problems in quite different areas: the model-theoretic question of whether
S
O
P
2
SOP_2
is maximal in Keisler’s order, and the question from general topology/set theory of whether
p
=
t
\mathfrak {p} = \mathfrak {t}
, the oldest problem on cardinal invariants of the continuum. We do so by showing these problems can be translated into instances of a more fundamental problem which we state and solve completely, using model-theoretic methods.