We consider a family of Caffarelli–Kohn–Nirenberg interpolation inequalities and weighted logarithmic Hardy inequalities that were obtained recently as a limit case of the Caffarelli–Kohn–Nirenberg inequalities. We discuss the ranges of the parameters for which the optimal constants are achieved by extremal functions. The comparison of these optimal constants with the optimal constants of Gagliardo–Nirenberg interpolation inequalities and Gross's logarithmic Sobolev inequality, both without weights, gives a general criterion for such an existence result in some particular cases.