We investigate the relationship between non-Markovianity and the effectiveness of a dynamical decoupling (DD) protocol for qubits undergoing pure dephasing. We consider an exact model in which dephasing arises due to a bosonic environment with a spectral density of the Ohmic class. This is parametrized by an Ohmicity parameter by changing which we can model both Markovian and non-Markovian environments. Interestingly, we find that engineering a non-Markovian environment is detrimental to the efficiency of the DD scheme, leading to a worse coherence preservation. We show that each DD pulse reverses the flow of quantum information and, on this basis, we investigate the connection between DD efficiency and the reservoir spectral density. Finally, in the spirit of reservoir engineering, we investigate the optimum system-reservoir parameters for achieving maximum stationary coherences.