This is an analytic study of the two-dimensional XY spin glass with $\pm J$ disorder. The Hamiltonian has a continuous spin symmetry and a discrete chiral symmetry, and therefore possesses, potentially, two different order parameters and correlation lengths. The cost of breaking the symmetries is probed by comparing the ground state energy under periodic (P) boundary conditions with the one under antiperiodic (AP) and under reflecting (R) boundary conditions. Two energy differences (``domain wall energies'') appear, $\Delta E^{AP}$ and $\Delta E^R$, whose scaling behavior with system size is nontrivially related to the correlation length exponents. For a specific distribution of the $\pm J$ disorder we show that the chiral and spin correlation lengths diverge with the same exponent as $T\downarrow 0$. The common exponent has a common cause, viz. the low reversal energy of domains of chiral variables. For general disorder we give a heuristic argumentation in terms of droplet excitations that leads to spin ordering on a longer, or equal, scale than chiral ordering. These results are in contrast with interpretations of Monte Carlo simulations.