Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

1115


Chapter 49: Partitioning


49


scalability. Even though the view’s union includes all three partition tables, the query
execution plan, as shown in Figure 49-2, reveals that the query processor accesses only the
SalesOrderHeadUS partition table:

SELECT OrderNumber
FROM OrderAll
WHERE LocationCode = 'KDH'

FIGURE 49-1
The partition table’s query plan, when run without a WHERE clause restriction, includes all the
partition tables as a standard union query.

Updating Through the Partition View
Union queries are typically not updatable. Yet, the partition tables’ check constraints
enable a partition view based on a union query to be updated, as long as a few conditions
are met:

■ The partition view must include all the columns from the partition tables.

■ (^) The primary key must include the partition key.
■ Partition table columns, including the primary key, must be identical.
■ (^) Columns and tables must not be duplicated within the partition view.
c49.indd 1115c49.indd 1115 7/31/2012 10:24:23 AM7/31/2012 10:24:23 AM
http://www.it-ebooks.info

Free download pdf