Add mysql optimisation for amiado