You must Sign In to post a response.
  • Category: SQL Server

    Please help me to update large sql server database column

    Hello Spiders

    I need help to update my one table column from another table,here is my situation.

    Hardware- 8GB Ram,Xeon Processor,1TB Internal Harddisk
    Software - Sql Server 2014

    I have two sql database and each have a table.

    (1)table1(db1)
    275MN+ row count,350 columns
    unique column=Id(18 char in each Id)
    to be updated column=U_col1,U_col2

    (2)table2(db2)
    230MN+ row count,8 columns
    unique column=Id(18 char in each Id)
    to be set column =_col1,_col2

    Here is my Query for Update=

    Update db1.table1
    set T1.U_col1=T2._col1, T1.U_col2=T2._col2
    from db1.table1 T1,db2.table2 T2
    where T1.Id=T2.Id

    I had not added any Indexes because of the performances issues

    So suggest me to run successfully all columns to be updated.

    Give me some answers of this questions.

    (1) can i run update without using any indexes?
    (2)Suggest which index to be used on which column in bot table(clustered,non-clustered,clustered column store,non-clustered column store)
    (3)Or Any other index or Update trick

    I am Ok if query runs 24 Hours,36 Hours or may be more but i wanted to complete the query successfully.

    Let me know if you want to know anything else?

    Thanks
  • #769358
    Update would be quick if both the large tables have clustered index added on it
    Please mark this as Answer, if this helps

    Regards,
    Alwyn Duraisingh.M 
    << Database Administrator >>
    Jesus saves! The rest of us better make backups...

  • #769404
    Hi,
    if you are using the Index for update it will take more time to execute. Kindly don't refer the any Index. According to your query u can use the inner join for joining those tables instead of (,) comma in query.

    Query :
    Update db1.table1
    set T1.U_col1=T2._col1, T1.U_col2=T2._col2
    from db1.table1 T1 Inner Join db2.table2 T2
    where T1.Id=T2.Id


  • Sign In to post your comments