  We observe that local embedding problems for certain Hardy and Bergman spaces
of Dirichlet series are equivalent to boundedness of a class of composition
operators. Following this, we perform a careful study of such composition
operators generated by polynomial symbols $\varphi$ on a scale of Bergman--type
Hilbert spaces $\mathcal{D}_\alpha$. We investigate the optimal $\beta$ such
that the composition operator $\mathcal{C}_\varphi$ maps $\mathcal{D}_\alpha$
boundedly into $\mathcal{D}_\beta$. We also prove a new embedding theorem for
the non-Hilbertian Hardy space $\mathcal H^p$ into a Bergman space in the
half-plane and use it to consider composition operators generated by polynomial
symbols on $\mathcal{H}^p$, finding the first non-trivial results of this type.
The embedding also yields a new result for the functional associated to the
multiplicative Hilbert matrix.
