Question: #Microsoft SQL Server Step 1 : Please create a table T ( using a CREATE TABLE statement ) with few columns. You have the freedom
#Microsoft SQL Server
Step : Please create a table T using a CREATE TABLE statement with few columns. You have the freedom to choose the schema of the table. Make sure that the table has no indexes and no primary keys. Consequently, a table scan would be the only option to scan the table
Step : Using a loop to insert n rows.
Step : Run a "SELECTFrom T and record the execution time for the query for different values of n for example n these numbers are only used as a guideline but it is totally fine to use different values of n based on the speed and strength of your machine
Step : Create a clustered index primary key and repeat step you will need to delete all rows in the table and insert different number of rows again to rerun the experiment With the clustered index, we expect the query to read the rows from the table using a clustered index scan.
Step : Create a nonclustered index on one column of the table say coland run a query SELECT Col from T for the same values of n as in step with a nonclustered index and selecting the column that the nonclustered index is built on we expect a nonclustered index scan in the query plan
What to submit: Please submit one file that contains
The SQL script that creates and query the table
The query plans that utilizes the Table scan Clustered index scan Nonclustered index scan
A table that shows the execution time of the runs table scan, clusteredindex scan, nonclustered index scan for the different values of n
Your comments and reflections on the execution times you got from these runs. Do you think the index really matters in the query perf?
please give the detailed code and run correctly, thank you
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
