I been looking for some general Tips and Tricks for Query Opitimization in SQL Server 2008.
I came accross the below which am quite unsure what are the consequences of using views / triggies
- Try to replace views with original source table
- Triggers should not be used if possible, incorporate the logic of trigger in stored
procedure
Can someone shed light on these explaining pros and cons and also point me to list of general Tips and Tricks for Query optimization.
A view is a virtual table formed from a query such as ‘SELECT a, b FROM tableC’ This creates a ‘virtual table’ of a & b. A source table is the table its self, and it is far more efficient to be able to ‘SELECT * FROM tableC’ so that a virtual table is not created.
Triggers are events that are triggered when a specified event happens, such as a specific query. Stored procedures are compiled transactions and can function exactly like a trigger except they are far more efficient. In short, do not use triggers.
I would seriously consider this http://www.amazon.com/SQL-Tuning-Dan-Tow/dp/0596005733/ref=sr_1_1?ie=UTF8&qid=1345679033&sr=8-1&keywords=sql+optimization