我正在尝试搜索包含名称' CCR Tech'的公司,我有30个包含相同列名的表,我的SQL查询的执行时间大约是6秒,这太高了。如何优化我的SQL查询?
我的查询:
SELECT c.corporate_identification_number as cin, c.company_name as label FROM
(SELECT * FROM jas_company_master_west_bengal WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_uttrkhand WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_uttar_pradesh WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_ut WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_telengana WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_tamil_nadu WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_rajasthan WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_punjab WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_odisha WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_nagaland WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_mizoram WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_meghalaya WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_manipur WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_maharastra WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_madhya_pradesh WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_kerala WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_karnataka WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_jharkhand WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_jammu_kashmir WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_haryana WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_gujarat WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_goa WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_delhi WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_bihar WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_assam WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_arunachal_pradesh WHERE LOWER(company_name) LIKE 'ccr tech%'
UNION
SELECT * FROM jas_company_master_andhra_pradesh WHERE LOWER(company_name) LIKE 'ccr tech%') as c
WHERE 1