Hi All,
I want to optimize this query as it is taking long to execute almost a second
Here's the query:
IF Exists(
Select CustFirstName From Customers
Where (CustFirstName = InputCustFirstName)
OR (CustLastName= InputCustLastName)
OR (Email = InputEmail)
);
All these three columns have Unique index on it. and I have 765704 records in it.
This is the explain result set of my query :
----+-------------+-------+------+----------------------+------+---------+------+--------+-----------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+----------------------+------+---------+------+--------+-----------------------------------+ | 1 | SIMPLE | Customers | ALL | CustName | NULL | NULL | NULL | 765704 | Using where with pushed condition | +----+-------------+-------+------+----------------------+------+---------+------+--------+-----------------------------------+
Can anyone assist me on how to optimize it.