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 ϕ on a scale of Bergman-type Hilbert spaces D α . We investigate the optimal β such that the composition operator C ϕ maps D α boundedly into D β . We also prove a new embedding theorem for the non-Hilbertian Hardy space H p into a Bergman space in the half-plane and use it to consider composition operators generated by polynomial symbols on H p , finding the first nontrivial results of this type. The embedding also yields a new result for the functional associated to the multiplicative Hilbert matrix. 1 2 < ∞.Here d (n) denotes the number of divisors of the positive integer n. Note that D 0 = H 2 . We are interested in the range α ≥ 0 and, as explained in [1], these spaces may be thought of as Dirichlet series analogues of the classical scale of weighted Bergman spaces in the unit disc. Since d (n) = O (n ε ) for every ε > 0, it follows from the Cauchy-Schwarz inequality that Dirichlet series in D α also are absolutely convergent in C 1/2 .Due to an insight of H. Bohr (see Section 2), both H p and D α can be identified with certain function spaces in countably infinite number of complex variables, and -consequently -the