Need Help with SQL Server (Indexes)
Watch video Indexes In SQL Server
1. Run the script file "Create database 1.sql", this will create the database Index_Examples and two tables, dbo.raw_data, dbo.index_example. & it will insert 2000 rows of data into dbo.raw_data. Next run the script Script File for Index Assignment.sql". It will insert 4,000,000 rows into the dbo.index_example table (id, first_name, last_name, birthday). If I created a database with more it will bog down your CPU. With 4 million rows, you will see the difference in time between a non-index query and an index query. You are looking for the SQL Server Execution Time.
2. Run the following queries separately and record the time it took to complete each (see attached document "Example of Solution of Index Assignment.pdf"). You will have to set up the query window to show statistics & time. Go to the pull down menu Query, click on Query Options, under Execution, Advance check the box SET STATISTICS TIME, click OK.
USE [Index_Examples]
GO
select count(*) from dbo.index_example where last_name ='Waters';
Screen Shot Goes Here!
select count(*) from dbo.index_example where first_name ='Colman';
Screen Shot Goes Here!
select count(*) from dbo.index_example where birthday ='2000-01-01';
Screen Shot Goes Here!
select first_name, last_name, birthday from index_example where last_name ='Waters' order by last_name, first_name, birthday;
Screen Shot Goes Here!
select first_name, last_name, birthday from index_example where first_name ='Colman' order by last_name, first_name, birthday;
Screen Shot Goes Here!
select first_name, last_name, birthday from index_example where birthday = '2000-01-01' order by last_name, first_name, birthday;
Screen Shot Goes Here!
select first_name, last_name, birthday from index_example where last_name = 'Waters' and birthday = '2000-01-01' order by last_name, first_name, birthday;
Screen Shot Goes Here!
3. Create 3 indexes for this database, and record the time it took to create each.
a) Create an index for the Last_Name column
Index Goes Here!
Screen Shot Goes Here!
b) Create an index for the First_Name column
Index Goes Here!
Screen Shot Goes Here!
c) Create an index for the birthday column
Index Goes Here!
Screen Shot Goes Here!
d) Create an index for the Last_Name and birthday column
Index Goes Here!
Screen Shot Goes Here!
4. Run the seven queries from step 1, separately and record the time it took to complete each (see attached document "Example of Solution of Index Assignment.pdf").
USE [Index_Examples]
GO
select count(*) from dbo.index_example where last_name ='Waters';
Screen Shot Goes Here!
select count(*) from dbo.index_example where first_name ='Colman';
Screen Shot Goes Here!
select count(*) from dbo.index_example where birthday ='2000-01-01';
Screen Shot Goes Here!
select first_name, last_name, birthday from index_example where last_name ='Waters' order by last_name, first_name, birthday;
Screen Shot Goes Here!
select first_name, last_name, birthday from index_example where first_name ='Colman' order by last_name, first_name, birthday;
Screen Shot Goes Here!
select first_name, last_name, birthday from index_example where birthday = '2000-01-01' order by last_name, first_name, birthday;
Screen Shot Goes Here!
select first_name, last_name, birthday from index_example where last_name = 'Waters' and birthday = '2000-01-01' order by last_name, first_name, birthday;
Screen Shot Goes Here!
5. In DETAIL what conclusion did you come to about indexes?
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.