Well. Solution of sodium alkylsulfonates are good detergents, because they produce calcium alkylsulfonates in hard water, and these calcium derivates are soluble in water. By contrast, usual soap produce calcium alkylcarboxylates (like oleate, palmitate, etc.) in hard water, and these compounds are not soluble in water. Soap may be a good detergent : it removes stains. But it replaces the stain by a deposit of calcium carboxylate. This is not what is expected when cleaning dirty clothes.
 
Anyway, the problem of the solubility is not yet perfectly understood. For example, why is $\ce{CaCl2}$ extremely soluble in water ($56$ g. $\ce{CaCl2}$ in $100$ mL water), and why is $\ce{CaF2}$ extremely insoluble in water, despite the fact that chlorine and fluor should have similar chemical properties ?