Databases Reference
In-Depth Information
DTA can analyze workload or even a single query but analyzing a workload is one of the
famous ways in DTA because a properly created workload has all different queries that we use
to execute in the database, and wide range of query helps DTA to make good decision, based
on the workload provided.
How to do it...
Follow the ensuing steps to create some sample tables in the AdventureWorks2012 database
for demonstration:
1.
Create a table ordDemo and insert some records into that table with the
following script:
Use AdventureWorks2012
GO
--if orders table is already there. you can delete it than
--create new one with name "Orders"
IF OBJECT_ID('ordDemo', 'U') IS NOT NULL
BEGIN
DROP TABLE ordDemo
END
GO
--creating table for demonstration
CREATE TABLE ordDemo (OrderID INT IDENTITY, OrderDate DATETIME,
Amount MONEY, Refno INT)
GO
--inserting 100000 sample rows into table
INSERT INTO ordDemo (OrderDate, Amount, Refno)
SELECT TOP 100000
DATEADD(minute, ABS(a.object_id % 50000 ), CAST('2011-11-04'
AS DATETIME)),
ABS(a.object_id % 10),
CAST(ABS(a.object_id % 13) AS VARCHAR)
FROM sys.all_objects a
CROSS JOIN sys.all_objects b
GO
2.
Create two more tables ProductDemo and ProductModelDemo from the existing
table of our database AdventureWorks2012 with the help of the following script.
IF OBJECT_ID('ProductDemo') IS NOT NULL
DROP TABLE ProductDemo
GO
IF OBJECT_ID('ProductModelDemo') IS NOT NULL
DROP TABLE ProductModelDemo
GO
 
Search WWH ::




Custom Search