  The height of a piecewise-testable language $L$ is the maximum length of the
words needed to define $L$ by excluding and requiring given subwords. The
height of $L$ is an important descriptive complexity measure that has not yet
been investigated in a systematic way. This article develops a series of new
techniques for bounding the height of finite languages and of languages
obtained by taking closures by subwords, superwords and related operations.
  As an application of these results, we show that
$\mathsf{FO}^2(A^*,\sqsubseteq)$, the two-variable fragment of the first-order
logic of sequences with the subword ordering, can only express
piecewise-testable properties and has elementary complexity.
