Posts

Showing posts from May 11, 2019

Do varchar(max), nvarchar(max) and varbinary(max) columns affect select queries?

Image
5 1 Consider this table: create table Books ( Id bigint not null primary key identity(1, 1), UniqueToken varchar(100) not null, [Text] nvarchar(max) not null ) Let's imagine that we have over 100,000 books in this table. Now we're given a 10,000 books data to insert into this table, some of which are duplicate. So we need to filter duplicates first, and then insert new books. One way to check for the duplicates is this way: select UniqueToken from Books where UniqueToken in ( 'first unique token', 'second unique token' -- 10,000 items here ) Does the existence of Text column affect this query's performance? If so, how can we optimized it? P.S. I have the same structure, for some other data. And it's not performing well. A friend t