This is a discussion on Re: Database design/optimization question within the SQL Server forums, part of the Microsoft SQL Server category; --> Quick question - since the values will all be from 1-100, is there any performance advantage to using tinyint ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Mike Thompson (begeneric@hotmail.com) writes: > Quick question - since the values will all be from 1-100, is there any > performance advantage to using tinyint instead of int? Yes, there is. To wit, int takes up four bytes and tinyint takes up one byte. That means that which ever model you go with, you can have more rows per page, and that means that SQL Server has do to less amount of disk access, which is a very significant factor in the execution-time equation. -- Erland Sommarskog, SQL Server MVP, sommar@algonet.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |
| |||
| Mike Thompson (begeneric@hotmail.com) writes: > Quick question - since the values will all be from 1-100, is there any > performance advantage to using tinyint instead of int? A caveat. Consider this script: declare @x tinyint, @y tinyint select @x = 9, @y = 18 select @x - @y This script fails with Server: Msg 8115, Level 16, State 2, Line 3 Arithmetic overflow error converting expression to data type tinyint. because tinyint does not include negative values. In your query you have the expression val1 - accuracy, so this could happen to you, both the value and the accuracy are tinyint. -- Erland Sommarskog, SQL Server MVP, sommar@algonet.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |
| ||||
| Hi, Refer this link for optimization and database design issue and solution. www.sql-server-performance.com Thanks , Amit begeneric@hotmail.com (Mike Thompson) wrote in message news:<91e39a0b.0306251156.37e5bc48@posting.google. com>... > Quick question - since the values will all be from 1-100, is there any > performance advantage to using tinyint instead of int? > > Thanks. > > Mike |