This is probably a simple question, but I pretty new to this. I am trying to set a column in an sql server using the following command:
update myTable
set myCol = a.col
from table2 as a
where a.col_1 = col_1 and a.col_2 = col_2;
myTable is a bout 150 million rows. and table2 about 300,000 rows. I have indexed table2 properly so the look up is fast. I tried this on a million row separately and it took around 20 secs. But the whole table is taking a very long time, over two days now, and still not finished. I wondered whether there is a better solution for this.
Thanks in advance.
I think the syntax of the
UPDATEstatement should beand you need to supply compound
INDEXon (col_1, col_2) on both tables.