Let ${mathbb{P}_t}_{t>0}$ be the classical Poisson semigroup on $mathbb{R}^d$ and $G^{mathbb{P}}$ the associated Littlewood-Paley $g$-function operator: $$G^{mathbb{P}}(f)=Big(int_0^infty t|frac{partial}{partial t} mathbb{P}_t(f)|^2dtBig)^{frac12}.$$ The classical Littlewood-Paley $g$-function inequality asserts that for any $1<p<infty$ there exist two positive constants $mathsf{L}^{mathbb{P}}_{t, p}$ and $mathsf{L}^{mathbb{P}}_{c, p}$ such that $$ big(mathsf{L}^{mathbb{P}}_{t, p}big)^{-1}big|fbig|_{p}le big|G^{mathbb{P}}(f)big|_{p} le mathsf{L}^{mathbb{P}}_{c,p}big|fbig|_{p},,quad fin L_p(mathbb{R}^d). $$ We determine the optimal orders of magnitude on $p$ of these constants as $pto1$ and $ptoinfty$. We also consider similar problems for more general test functions in place of the Poisson kernel. The corresponding problem on the Littlewood-Paley dyadic square function inequality is investigated too. Let $Delta$ be the partition of $mathbb{R}^d$ into dyadic rectangles and $S_R$ the partial sum operator associated to $R$. The dyadic Littlewood-Paley square function of $f$ is $$S^Delta(f)=Big(sum_{RinDelta} |S_R(f)|^2Big)^{frac12}.$$ For $1<p<infty$ there exist two positive constants $mathsf{L}^{Delta}_{c,p, d}$ and $ mathsf{L}^{Delta}_{t,p, d}$ such that $$ big(mathsf{L}^{Delta}_{t,p, d}big)^{-1}big|fbig|_{p}le big|S^Delta(f)big|_{p}le mathsf{L}^{Delta}_{c,p, d}big|fbig|_{p},quad fin L_p(mathbb{R}^d). $$ We show that $$mathsf{L}^{Delta}_{t,p, d}approx_d (mathsf{L}^{Delta}_{t,p, 1})^d;text{ and }; mathsf{L}^{Delta}_{c,p, d}approx_d (mathsf{L}^{Delta}_{c,p, 1})^d.$$ All the previous results can be equally formulated for the $d$-torus $mathbb{T}^d$. We prove a de Leeuw type transference principle in the vector-valued setting.