Monday, June 18, 2007

Can I Get Herpes From A Tanning Bed?

Management queries on partitioned views ...

Hi everyone!

After numerous problems with partitioned views, I wish to clarify certain rules to use to avoid problems with these whimsical.

First, I want to talk about the case of date fields used as a partition key. The optimizer of SQL Server is not able to correctly interpret the clauses CHECK on this type of data.
The easiest way is to create a field while accepting optimizing partitioned views. For example, the simplest with a partition key for the year is to create a field of type INT containing this information.

Thus, the partition key will no longer be the date field we posed a problem, but the field INT which will be supported without any problems.
I wish I
then discuss the problems of query mode. Indeed, the query optimizer of SQL Server Parameterization of effecting the process before the Planning process the query, SQL Server does not perform the optimizations needed in the following query: DECLARE @

TEST INT SET @ TEST = 50
SELECT Id, PartitionCol VALL FROM WHERE = @ TEST PartitionCol


We can then focus on Dynamic SQL in this specific case, the only solution to get the desired result.

Finally, I wanted to draw attention to the importance of statistics in the connection with the use of partitioned views. Indeed, poor statistics lead the storage of a bad execution plan. Performance will then feel very important, especially in the context of the use of stored procedures, which in case of parameterization of ad hoc queries.

Good evening!

0 comments:

Post a Comment