Hi Paul,
Thanks, views with triggers really powerful stuff. New alternatives for
architectural design.
Now it got me thinking more of these questions:
1) While I suspect there will be some performance overhead using the
StockView case, but based on your experience, would there be a HUGE
performance overhead, or would it be within an acceptable range?
2) On a similar note, how would the performance acceptability be if I add
index to the StockView?
If performance overhead is acceptable, then the StockView would certainly
behave like a Stock table!
> The easiest way to achieve this is to partition the table into 2 tables and
> just replicate one of them. A view can be used to amalgamate the data, and
> an instead of trigger used to allow users to treat the view much like a
> table.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
Paul Ibison - 31 May 2006 09:22 GMT
If we conisder Table1 has 4 columns A,B,C,D where A is the PK. We partition
this table to Table2(A,B,C) and Table3(A,D) and create a view which
amalgamates the data together by inner joining the column As. Using the
"instead of" trigger should be fast, because updates and deletes are both
based on column A (the PK values) of the 2 tables. You could add an index to
the view but there shouldn't be any need - you'll be joining on the PK of
each table and these indexes will be picked up in any query.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com