Curious Question - VARCHAR(MAX)

  • Is there any difference between the below two statements in terms of performance? I believe the storage space implications are identical, but please correct this assumption if wrong.

    Insert into Table1 (TextField) Values('Hello World') --TextField is varchar(max) data type

    Insert into Table2 (TextField) Values('Hello World') --TextField is varchar(11) data type

  • it depends on the types of data you will store.

    In the example provided - agreed there is no performance implication.

    however if the data stored in the varchar(max) exceeds 8kb than sql stores it in addition pages and i suppose with fragmentation etc there may be performance implications.

    ---- [font="Tahoma"]Live and Let Live![/font] ----

  • I'm pretty sure they'd be absolutely identical, but run them with profiler or look at the STATISTICS IO output to verify.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply