You should not use the smallest aperture available, you should use an aperture that allows you to focus at an hyperfocal distance that puts both the foreground and infinity in focus.
If you use an aperture that is too small, diffraction will make the image soft. You will get a great DOF, but most of that will be beyond what you need to get your subject in focus.
Small apertures can mean soft images – why?
The ideal DOF would stretch from the object in your foreground to infinity.
There is a formula on the Wikipedia page that I linked to, and applying that to 18mm and f22 gives you:
H = 18² / (22 * 0.03) = 490.9 mm
That means that you have a DOF that stretches from H/2 = 0.24 m to infinity. That is clearly more than you need.
If we try it with f5.6 instead:
H = 18² / (5.6 * 0.03) = 1928,6 mm
That gives you a DOF that stretches from 0.96 m to infinity. That is still more than you need in most cases.
If we try that with the 50mm lens:
H = 50² / (5.6 * 0.03) = 14881 mm
That gives you a DOF that stretches from 7.4 m to infinity, which should be enough for most cases.
So, you have been trying apertures that are way too small for your needs. You can aim for an aperture that gives you the optimum DOF, or perhaps half a stop or a full stop smaller just to be on the safe side. That should still keep you far from the smallest aperture, and also give you a lot better exposure times.