Yes, to clarify this change. There was a cleanup routine that ran on the sessions table which was triggered when each session started. On big sites, this could become slow, and would run often (each new session).
The solution did two things. First, it put an index on the dates fields in the sessions table:
/****** Improve cleanup of expired sessions ******/CREATE NONCLUSTERED INDEX [SESS_DateLastUpdated] ON [dbo].[tblKartrisSessions]( [SESS_DateLastUpdated] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]GO
This makes the deletion of expired sessions far quicker because it's deleting based on the date, and the index allows it to identify and find items by date much more quickly.
Secondly, we moved the cleanup sessions routine out of the session_start and into the application_start part of the global.asax. This way, the routine only runs occasionally, instead of many times a day. Because it only really needs to do an occasional clean up.