The phased array ultrasonic total focusing method for weld detection of ship heterogeneous structure is of high signal-to-noise ratio and strong adaptability, but it is of many problems such as excessive computation and artifacts. The optimization scheme of the method is proposed according to the acoustic beam directivity. It can greatly improve the calculation speed to filter the reconstruction points in the acoustic field of non acoustic beam directivity, and can optimize the artifact problem when obtaining the same amplitude of full matrix by default under the same path. The optimization method is used to the heterogeneous structure to obtain the high efficiency and high quality detection results, which provides ideas for meeting the engineering requirements of large-scale online non-destructive testing of Al-Ti steel composite joints.