I’m asked to get the information based on a specific ID( here 406f-871b-a3ee71f7038) , like so :
select * from BIG_Session (nolock)
where SessionSID like '%406f-871b-a3ee71f70386%'
is this inefficient? How long is too long to wait for it to finish? I waited 30 seconds and felt that that was too long, and just canceled it.
You will be causing a scan with the prefix wildcard character
%. If you know that406f...will be the beginning of the string you can utilize a possible seek:Notice I took out the first percent sign.
That depends on you, your environment, your users, and what is an acceptable duration for your business requirements. 30 seconds is acceptable in certain situations/environments, but detrimental in others.