SQL Server interview questions: – Mention Fragmentation in SQL Server?

This is the SQL Server interview questions which are asked during the interview not so frequent. But still go through it once before going for the interview.

Speed issues occur because of two major things

  • Fragmentation.
  • Splits.

Splits have been covered in the first questions. But one other big issue is fragmentation. When database grows it will lead to splits, but what happens when you delete something from the database…HeHeHe life has lot of turns right. Ok let’s say you have two extents and each have two pages with some data. Below is a graphical representation. Well actually that’s now how things are inside but for sake of clarity lot of things have been removed.

sql

Figure: – Data Distribution in Initial Stages

Now over a period of time some Extent and Pages data undergo some delete. Here is the modified database scenario. Now one observation you can see is that some page’s are not removed even when they do not have data. Second If SQL server wants to fetch all “Females” it has to span across to two extent and multiple pages within them. This is called as “Fragmentation” i.e. to fetch data you span across lot of pages and extents. This is also termed as “Scattered Data”.

sql

Figure: – Data Distribution after Deletes

What if the fragmentation is removed, you only have to search in two extent and two pages. Definitely, this will be faster as we are spanning across less entities

sql

Figure: – Fragmentation removed

See the following video on calling a stored procedure using LINQ: –

Click for more SQL Server interview questions

Regards,

Visit for more author’s blog on SQL Server interview questions

About C#.NET, ASP.NET MVC Core, Angular, Azure, (MSBI)Business Intelligence, Data Science - Python Interview Questions

This blog is for developers who want to crack .NET and C# interviews. It has all tips and tricks needed to crack .NET interviews , C# interview , SQL Server interview , Java interview , WCF Interview , Silverlight interview , WPF interview , LINQ interview , Entity framework Interview. Do not forget to watch our Learn step by step video series. ASP.NET MVC Interview Questions and Answers:- https://youtu.be/pXmMdmJUC0g C# Interview Questions and Answers:- https://youtu.be/BKynEBPqiIM Angular Interview Questions and Answers:- https://youtu.be/-jeoyDJDsSM C# tutorial for beginners(4 hrs.):- https://youtu.be/AxEGRBFwlmI Learn Azure Step by Step:- https://youtu.be/wdUK7bCMXqs Azure AZ-900 fundamentals certification :- https://youtu.be/hC9iGgJorz8 AZ- 204 certification Azure:- https://youtu.be/qI8PRn2C080 Learn Angular tutorial step by step https://tinyurl.com/ycd9j895 Learn MVC 5 step by step in 16 hours:- https://youtu.be/Lp7nSImO5vk Learn Design Pattern Step by Step https://goo.gl/eJdn0m Learn MSBI Step by Step in 32 hours:- https://goo.gl/TTpFZN Learn SQL Server Step by Step http://tinyurl.com/ja4zmwu Python Tutorial for Beginners:- https://youtu.be/KjJ7WzEL-es Learn Data Science in 1 hour :- https://tinyurl.com/y5o7qbau Learn Power BI Step by Step:- https://tinyurl.com/y6thhkxw Learn Tableau step by step :- https://tinyurl.com/kh6ojyo
This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

2 Responses to SQL Server interview questions: – Mention Fragmentation in SQL Server?

  1. Pingback: DotNetShoutout

  2. Pingback: SQL Server interview questions: – Mention... | .NET | Syngu

Leave a comment