Databases Reference
In-Depth Information
So, let's see an example. Run the following query to create a new table on the Adven-
tureWorks database:
SELECT * INTO dbo . Address
FROM Person . Address
Listing 3-48.
Inspect the number of rows by running the following queries; they should show
19,614 rows:
SELECT * FROM sys . partitions
WHERE object_id = object_id ( 'dbo.Address' )
Listing 3-49.
SELECT * FROM sys . dm_db_partition_stats
WHERE object_id = object_id ( 'dbo.Address' )
Listing 3-50.
Now run the following query, and inspect the graphical execution plan:
SELECT * FROM dbo . Address
WHERE City = 'London'
Listing 3-51.
Running this query will create a new statistics object for the City column, and will show
the plan in Figure 3-13. Note that the estimated number of rows is 434, and it's using a
simple Table Scan operator.
Search WWH ::




Custom Search