• yuvipoy (3/4/2014)


    I am having 10 Master table with 10 million records each.

    For unique(primary key) i have use uniqueidentifier as column data type.

    While inserting more records on this table insert is slow.

    Is this because of uniqueidentifier column?

    if so then what can be the alternative.

    My table consists of 5 float 10 varchar,3 bit, 8 int,2 uniqueidentifier,4 char, 1 bigint.

    uniqueidentifier column is fk for other tables , while joining the columns have used uniqueidentifier column as a primary key.

    say

    TableA C1 uniqueidentifier (PK), C2 uniqueidentifier, C3 ......

    TableB C1 uniqueidentifier , C2 uniqueidentifier (FK_TableA_uniqueidentifier ), C3 ......

    You said your uniqueidentifier is your primary key. Is it also you clustered index? I am not a fan of using uniqueidentifiers as a primary key for almost every situation. But if there is a different column used as the clustered index they aren't horrible. A clustered index on a uniqueidentifier will exceed 90% fragmentation in as few as 1000 rows. I am guessing this is what you are running into. Find another column(s) to contain your clustered index and your performance will improve greatly.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/