Tuesday, December 28, 2010

Query Performance and multi-statement table valued functions - CSS SQL Server Engineers - Site Home - MSDN Blogs

Common Table Expressions (CTEs) and table-valued functions (TVFs) are features in SQL 2005/2008 that solve a lot of problems for me in terms of functionality and compartmentalizing code. 

They also cause issues with performance for larger datasets.  There are some ways around this.  Hopefully SQL.Next solves some of these issues for us…. in the meantime.

Lately I worked with a customer to help tune his query involving multi-statement table valued function.   When using table valued functions, you should be aware of a couple of things

First, there are two type of table valued functions which are inline table valued function (Inline TVF) and multi-statement table valued function (multi-statement TVF).    Inline table valued function refers to a TVF where the function body just contains one line of select statement.   There is not return variable.   Multi-statement table valued function refers to a TVF where it has a return table  variable.  Inside the function body, there will be statements populating this table variable.  In the demo at the end of this blog, there are examples of inline TVF and multi-statement TVF.

Secondly, multi-statement TVF in general gives very low cardinality estimate.

Query Performance and multi-statement table valued functions - CSS SQL Server Engineers - Site Home - MSDN Blogs

Data Type Mapping with Distributed Queries

For those using linked servers or SSIS/DTS to external databases, this MSDN article provides details on data type mappings.

An OLE DB provider exposes the data types of its data according to OLE DB type identifiers called DBTYPEs. Data types are converted between OLE DB data types and SQL Server system data types by mapping data:

  • From OLE DB data types to SQL Server system data types. This conversion occurs when SQL Server reads data from the OLE DB data source, either in SELECT statements or in the reading side of UPDATE, INSERT, or DELETE statements.

  • From SQL Server system data types to OLE DB data types. This conversion occurs when SQL Server writes data, mostly in INSERT or UPDATE statements, into the OLE DB data source in which the modified table is a remote table.

Data Type Mapping with Distributed Queries

Tuesday, December 21, 2010

I Need #SQLHelp! | Brent Ozar - Too Much Information

Need instant SQL Help?  Here is the post.

I Need #SQLHelp! | Brent Ozar - Too Much Information

Wednesday, December 15, 2010

SQL Azure Compatibility

An enormous 95-slide deck has been published as a briefing on cloud computing at MS and the Azure platform.

Slide 67 has some of the features in and out of SQL Azure.

What’s not supported:

  • XML, HierarchyID, Sparse Columns, Filestream data types. (XML support would be a biggie for some clients)
  • Partitions
  • Full-text indexes (again, some clients leveraging this)
  • SQL-CLR

Thursday, December 09, 2010

SQL Server: Top 10 Secrets of a SQL Server Expert | TechNet Magazine

Paul Randal provides 10 musts for SQL DBAs

SQL Server: Top 10 Secrets of a SQL Server Expert

Maintaining a SQL Server environment is a potentially complex endeavor. Here are the top 10 ways you can minimize complexity and reduce stress.

SQL Server: Top 10 Secrets of a SQL Server Expert | TechNet Magazine

Wednesday, December 08, 2010

Report Server Catalog Best Practices - Technical Notes

Excellent best practices guide for RS 2005 installs

Report Server Catalog Best Practices

Building and Deploying Large Scale SQL Server Reporting Services Environments—Technical Note Series

Report Server Catalog Best Practices - Technical Notes