My query takes a lot of time, 22 seconds and above. After 22 seconds, we get more than 900 000 records. We have created indexes on the table which are used in the query:
select * from ContactMaster where ContactId in ( select ContactId from ListContactMaster where ListMasterID in (816,975,945) and ContactId not in ( select ContactId from ListContactMaster where ListMasterID in (0) ) and ( isactive='true' or isactive is null ) ) and isactive = 'true' and ( isdeleted='false' or isdeleted is null ) and emailaddress not in ( select emailaddress from supresscontacts ) and ContactMaster.ContactId not in ( select DomineSupress.contactid from DomineSupress where DomineSupress.CampaignId=1186 )
ContactMaster table has more than 50 fields.