Re: Varchar vs. Text

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Louis Davidson (dr_dontspamme_sql_at_hotmail.com)
Date: 02/04/05


Date: Fri, 4 Feb 2005 10:06:59 -0600

I think I might go that way to start. If you are always going to be
fetching the data, you are going to be paying the cost no matter what.
Obviously it might not be ideal, so I would do a good deal of performance
testing, but you should do that anyhow :)

-- 
----------------------------------------------------------------------------
Louis Davidson - drsql@hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design - 
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in 
consulting services.  All other replies may be ignored :)
"MG" <y4forums.t.mdgoyal@xoxy.net> wrote in message 
news:uQ6AEaqCFHA.3596@TK2MSFTNGP12.phx.gbl...
> The average comment would be around 250 - 500 bytes long. Comments will be
> added for only 10% of all the rows, but the field will be updated or 
> called
> everyone the stored procedure executes.
> I want to go with varchar because I would like to put a clustered index on
> the table, and because of the design limitations, the clustered index also
> gets updated with every update call and SQL won't perform the clustered
> index update along with the text column update.
>
>
> "Louis Davidson" <dr_dontspamme_sql@hotmail.com> wrote in message
> news:ub$tgTmCFHA.1084@tk2msftngp13.phx.gbl...
>> Depends.  How long will the average/typical comment be?  Why 7000?  Is
> this
>> just an arbitrary amount, or do you have requirements to go this long?
>> Also, will you need the comments every time you use the row?  And will 
>> you
>> need history of the comments?
>>
>> If you just want to give them extra space, and the average will be quite
>> short (which is a typical situation) then you might be fine.  Otherwise, 
>> I
>> might do something like:
>>
>> table
>> ======
>> tableKey
>> ---------
>> other columns
>>
>> tableComments
>> ===========
>> tableKey (fk to table.tableKey)
>> username
>> commentDate
>> --------------------
>> Comments
>>
>> All in all it depends on the requirements.
>>
>> -- 
>> --------------------------------------------------------------------------
> --
>> Louis Davidson - drsql@hotmail.com
>> SQL Server MVP
>>
>> Compass Technology Management - www.compass.net
>> Pro SQL Server 2000 Database Design -
>> http://www.apress.com/book/bookDisplay.html?bID=266
>> Note: Please reply to the newsgroups only unless you are interested in
>> consulting services.  All other replies may be ignored :)
>>
>> "MG" <y4forums.t.mdgoyal@xoxy.net> wrote in message
>> news:ORfP$5iCFHA.2568@TK2MSFTNGP10.phx.gbl...
>> > I'm in the process of designing a new table with a comment column that
>> > could
>> > be either varchar(7000) or text. I wanted to get an idea of positives 
>> > or
>> > negatives of going with the varchar(7000). The other columns in the
> table
>> > add upto 200 bytes so the row size would not exceed 8K in size.
>> >
>> > Thanks,
>> >
>> > Mike
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • Re: Checkpoint causes need for better IO subsystem?
    ... maybe it's not the IO and that maybe it's an indexing performance issue. ... Microsoft SQL Server MVP ... is this a monotonically increasing indexing scheme that I've created? ... the Clustered index is on multiple cols... ...
    (microsoft.public.sqlserver.tools)
  • Re: Indexes
    ... because we have a clustered index but I was expecting ... Only one row fit per page, so SQL Server ... You have 100000 rows in the table and 1000 rows fit per index page. ... >> Tibor Karaszi, SQL Server MVP ...
    (microsoft.public.sqlserver.server)
  • Re: Checkpoint causes need for better IO subsystem?
    ... excellent articles on clustered index selection and its impact on ... clustered index sql kimberly tripp ... Microsoft SQL Server MVP ... the random write capability of the drives comes into play, ...
    (microsoft.public.sqlserver.tools)
  • Re: Checkpoint causes need for better IO subsystem?
    ... Microsoft SQL Server MVP ... is this a monotonically increasing indexing scheme that I've created? ... Not sure about how to setup a monotonically increasing key. ... the Clustered index is on multiple cols... ...
    (microsoft.public.sqlserver.tools)
  • Re: Indexes Confuses me!!
    ... > The minimum I/O unit used by SQL Server is a page. ... and performs a bookmark lookup. ... If the table doesn't have a clustered index (aka ... reading the actual data row costs a single logical ...
    (microsoft.public.sqlserver.programming)