|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, January 31, 2012 6:01 AM
Points: 41,
Visits: 309
|
|
Dear all, I've a table that is modified daily and has a huge amount of data, and for performance issue, I need to insert the latest daily data into a another table to perform search operations with better spped, and so, I think I need to write a trigger after insert on the first table to insert the latest rows in the other table. How can I do that?
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Saturday, May 11, 2013 8:17 AM
Points: 460,
Visits: 2,521
|
|
From inside your trigger, you can access the INSERTED virtual table. This table will have the same structure as your main table and contain only the newly inserted data. You can then write an INSERT INTO statement which SELECTS columns FROM INSERTED.
.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 4:49 AM
Points: 1,075,
Visits: 5,119
|
|
and for performance issue, I need to insert the latest daily data into a another table to perform search operations with better spped
Have you created any indexes to improve the search? Any horizontal partitions?
I feel, creating a new table is not a good idea, just for search operation. Trigger may cause performance issue.
|
|
|
|