While looking at an actual execution plan, it's showing missing indexes even though the query is taking less than 1 second.
SELECT Account.AccountID, Account.Name FROM account LEFT OUTER JOIN accountfeaturesetting afs ON afs.accountid = account.accountid and afs.featureid = 'Schedules' and afs.settingid = 'EditReasons' WHERE ISNULL(afs.Value, '0') = '0' AND EXISTS (SELECT 1 FROM program WHERE program.AccountID = account.AccountID AND program.Active = 1 AND (program.ScheduleEditReasonFlags <> 0 OR program.ScheduleEditReasonFields <> 0)) AND account.IsMaster = 0 AND account.BeginDate IS NOT NULL
The execution plan is showing:
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>] ON [dbo].[Account] ([IsMaster],[BeginDate]) INCLUDE ([AccountID],[Name])
Do we need to create the index even though query is only taking 1 second? On what basis should an index be created?
I am going to run this query as a daily job.