Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Data Type and SQL performance

Author  Topic 

mikeallenbrown
Yak Posting Veteran

72 Posts

Posted - 2013-09-11 : 17:58:55
Does the data type effect SQL's performance? ...I have a table that has around 300 rows. About 25 of those rows are varchar(max). Most other rows are varchar(XX) and BIT. Does the data type matter at all? ...I'm still a SQL noobie.

Thanks in advance

-Mike

Mike Brown

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-09-11 : 18:31:31
It can to some degree. I’d focus on modeling the data appropriately. If that means you have a lot of NVARCHAR(MAX) columns, then so be it. If you find performance is an issue, then you can look at breaking those column out into another table. But, I’ve seen tables with millions/billions of rows that perform just fine, given the right indexing.
Go to Top of Page

ScottPletcher
Aged Yak Warrior

550 Posts

Posted - 2013-09-12 : 16:21:42
Yes, data type does affect performance. Any LOB (length=MAX) has some extra overhead.

But technically even varchar(3) is less efficient than char(3), smallint less than int, etc., although the difference on those are so slight it would probably take a huge number of rows to notice.

For only 300 rows, I doubt you'll see any noticeable difference with any data types.
Go to Top of Page

mikeallenbrown
Yak Posting Veteran

72 Posts

Posted - 2013-09-13 : 08:16:52
Thanks for the info!



Mike Brown
Go to Top of Page
   

- Advertisement -