2010年7月22日星期四

SQL Server stuffs

SQL 2008 Series: Triggers
http://www.youtube.com/watch?v=URs_rnzkmxs&feature=related

Trigger in SQL Server 2005 tutorial from wingslive.com
http://www.youtube.com/watch?v=5zyQIt-8NRQ&feature=related

SQL 2008 Series: Views
http://www.youtube.com/watch?v=to_0_bODY2Y&feature=channel

SQL Server 2008 T-SQL Debugger
http://www.youtube.com/watch?v=618LE_FZCxI&feature=related

Microsoft SQL Server 2005: Execution Plans
http://www.youtube.com/watch?v=uGi7_LkJXFI&feature=related

Using Statistics to Improve Query Performance
http://msdn.microsoft.com/en-us/library/ms190397.aspx

DBCC SHOW_STATISTICS (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms174384.aspx

Performance Tuning in SQL Server (GOOD)
http://www.youtube.com/watch?v=P97_oFfD218&NR=1

DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE

SET STATISTICS IO ON
SET STATISTICS TIME ON

1. Limit the number of columns returned
2. Create primary key on table
3. Create an Index on the columns in the WHERE clause

4. Limit the number of rows by using TOP
5. When working with joins, have an index on the columns in the JOIN and where clause
6. If you use multiple columns in WHERE or ORDER BY, create compound index, pay attention to the order of index
7. If you are trying to get unique values, use GROUP BY instead of DISTINCT

SQL Server 2008 Query Optimization - Part IV
http://www.youtube.com/watch?v=QFyJ2NtebzM&feature=channel

8. Use EXISTS instead of IN clause for sub queries
9. Use SET NOCOUNT OFF

Database Management Tool - SQL Server Profiler
http://www.youtube.com/watch?v=1RLuHzkyQy4

SQL Joins, nested loops and all that in less than 6 minutes
http://www.youtube.com/watch?v=SmDZaH855qE&feature=related

Rewriting SQL queries for Performance in 9 minutes (GOOD)
http://www.youtube.com/watch?v=ZVisY-fEoMw&feature=related
1. Try to remove the rows that not be able to seen in the final result set ASAP
2. group and sort as little column as possible
3. Join late

Query Tuning
http://msdn.microsoft.com/en-us/library/ms176005.aspx

General Index Design Guidelines
http://msdn.microsoft.com/en-us/library/ms191195.aspx

SET ANSI_NULLS { ON | OFF }

When SET ANSI_NULLS is ON, a SELECT statement that uses WHERE column_name = NULL returns zero rows even if there are null values in column_name. A SELECT statement that uses WHERE column_name <> NULL returns zero rows even if there are nonnull values in column_name.

SET QUOTED_IDENTIFIER { ON | OFF }
When SET QUOTED_IDENTIFIER is ON (default), identifiers can be delimited by double quotation marks, and literals must be delimited by single quotation marks. When SET QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact-SQL rules for identifiers.

没有评论:

发表评论