We examine the superconducting solution in the Holstein model, where the conduction electrons couple to the dispersionless boson fields, using the Migdal-Eliashberg theory and dynamical mean field theory. Although different in numerical values, both methods imply the existence of an optimal boson energy for superconductivity at a given electron-boson coupling. This nonmonotonous behavior can be understood as an interplay between the polaron and superconducting physics, as the electron-boson coupling is the origin of the superconductor, but at the same time traps the conduction electrons making the system more insulating. Our calculation provides a simple explanation of the recent experiment on sulfur hydride, where an optimal pressure for the superconductivity was observed. The validities of both methods are discussed.