How do I search for a unique identifier guid in SQLServer table, without doing table scans? Should I just use string or cast as uniqueidentifier? I see different examples on internet.
SELECT * FROM dbo.Product
where productGuid = '321F6C1D-3B28-4880-B1ED-434D7AE299D8'
SELECT * FROM dbo.Product
where productGuid = cast('321F6C1D-3B28-4880-B1ED-434D7AE299D8' as uniqueidentifier)
When doing text string search, I still saw seeks in execution plan. Should I cast as uniqueidentifier to be safe, since we are using Java and JDBCTemplate?