SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Files and Filegroups
Microsoft SQL Server
Rev 1.0-1406
By Naji El Kotob
naji [@] dotnetheroes.com
www.DotNETHeroes.com
Outlines
 Introduction to SQL Server files Architecture
 Understanding Pages and Extents
 About Files and Filegroups
 Primary and Secondary Filegroups
 Using Files and Filegroups
 Read-Only Filegroups
 Rules for Designing Files and Filegroups
 Recommendations
 RAID?
 FileGroup and RAID
 Interactive in-class DEMO
 QnA
 References
Database Sample
 AdventureWorks 2012 Database
 http://msftdbprodsamples.codeplex.com
Understanding Pages and Extents
 Pages
 The fundamental unit of data storage in SQL Server is the page.
 The disk space allocated to a data file (.mdf or .ndf) in a database is logically
divided into pages numbered contiguously from 0 to n.
 Disk I/O operations are performed at the page level.
 SQL Server reads or writes whole data pages.
In SQL Server, the page size is 8 KB. This means SQL
Server databases have 128 pages per megabyte.
Each page begins with a 96-byte header that is used
to store system information about the page.
http://technet.microsoft.com/en-us/library/ms190969(v=sql.105).aspx
Understanding Pages and Extents
 Extents
 Extents are a collection of eight physically contiguous pages and are used to
efficiently manage the pages. All pages are stored in extents.
 Extents are the basic unit in which space is managed.
 An extent is eight physically contiguous pages, or 64 KB. This means SQL Server
databases have 16 extents per megabyte.
A new table or index is generally allocated
pages from mixed extents. When the table
or index grows to the point that it has eight
pages, it then switches to use uniform
extents for subsequent allocations http://technet.microsoft.com/en-us/library/ms190969(v=sql.105).aspx
Files and Filegroups
 SQL Server maps a database over a set of
operating-system files.
 Data and log information are never mixed
in the same file, and individual files are
used only by one database.
 Filegroups are named collections of files
and are used to help with data placement
and administrative tasks such as backup
and restore operations.
http://technet.microsoft.com/en-us/library/ms179316(v=sql.105).aspx
Files default Extensions
 .MDF = Master Database File
 .LDF = Log Database File
 .NDF = Secondary Database File
Primary and Secondary Filegroups
 A primary filegroup contains the primary datafile (mdf).
 Tip: All system tables are allocated to the primary filegroup.
 A secondary filegroup (also called a user-defined filegroup) contains
secondary datafiles (ndf) and database objects.
 The default filegroup contains objects which were created without an
assigned filegroup.
 Tip: The primary filegroup is the default filegroup unless another filegroup is specified.
 Logfiles (.ldf) are never part of a filegroup.
Using Files and Filegroups
 File and Filegroup Fill Strategy
 Filegroups use a proportional fill strategy across all the files within each filegroup.
 For example, if file f1 has 100 MB free and file f2 has 200 MB free, one extent is allocated from file f1, two extents
from file f2, and so on. In this way, both files become full at about the same time, and simple striping is achieved.
 Improving Database Performance
 Using files and filegroups improves database performance, because it lets a database be created across multiple disks,
multiple disk controllers, or RAID (redundant array of independent disks) systems.
 Implementing Backup and Restore Strategies
 Databases made up of multiple filegroups can be restored in stages by a process known as piecemeal restore.
Read-Only Filegroups
 Any existing filegroup, except the primary filegroup, can be marked as read-
only.
 A filegroup marked read-only cannot be modified in any way.
 Tip: For tables that must not be modified, such as historical data, put them on filegroups and
then mark the filegroup as read-only. This prevents accidental updates.
Rules for Designing Files and Filegroups
 The following rules pertain to files and filegroups:
 A file or filegroup cannot be used by more than one database. For example,
file sales.mdf and sales.ndf, which contain data and objects from the sales
database, cannot be used by any other database.
 A file can be a member of only one filegroup.
 Transaction log files are never part of any filegroups.
Files and Filegroups Recommendations
 Most databases will work well with a single data file and a single transaction log file.
 If you use multiple files, create a second filegroup for the additional file and make that filegroup
the default filegroup.
 Tip: In this way, the primary file will contain only system tables and objects.
 To maximize performance, create files or filegroups on as many different available local physical
disks as possible.
 Tip: Put objects that compete heavily for space in different filegroups.
 Use filegroups to enable placement of objects on specific physical disks.
 Put different tables used in the same join queries in different filegroups.
 Tip: This will improve performance, because of parallel disk I/O searching for joined data.
 Put heavily accessed tables and the nonclustered indexes that belong to those tables on different
filegroups.
 Tip: This will improve performance, because of parallel I/O if the files are located on different physical disks.
 Do not put the transaction log file or files on the same physical disk that has the other files and
filegroups.
For more info http://technet.microsoft.com/en-us/library/ms187087(v=sql.105).aspx
RAID
http://www.gatan.com/images/knowhow/kh15_im3.png
FileGroup VS. RAID
 The best performance of your SQL Server database is to combine both multiple
Files/Filegroups and hardware RAID together.
 E.g.
 4 disks in a RAID-10 array for the data.
 2 disks using RAID-1 (mirroring) for the transaction log.
 1 disk for the non-clustered indexes
Q&A
 Please send your feedback to naji [@] dotnetheroes.com
References
 http://technet.microsoft.com/en-us/library/ms179316(v=sql.105).aspx (File
and Filegroups Architecture)
 http://www.prepressure.com/library/technology/raid
 http://macperformanceguide.com/Storage-RAID1-speed.html

Contenu connexe

Tendances

Delta lake and the delta architecture
Delta lake and the delta architectureDelta lake and the delta architecture
Delta lake and the delta architectureAdam Doyle
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017Gianluca Hotz
 
Performance Optimizations in Apache Impala
Performance Optimizations in Apache ImpalaPerformance Optimizations in Apache Impala
Performance Optimizations in Apache ImpalaCloudera, Inc.
 
A Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiA Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiDatabricks
 
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardDelta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardParis Data Engineers !
 
Presentation of Apache Cassandra
Presentation of Apache Cassandra Presentation of Apache Cassandra
Presentation of Apache Cassandra Nikiforos Botis
 
Apache Iceberg: An Architectural Look Under the Covers
Apache Iceberg: An Architectural Look Under the CoversApache Iceberg: An Architectural Look Under the Covers
Apache Iceberg: An Architectural Look Under the CoversScyllaDB
 
Running Apache Spark on Kubernetes: Best Practices and Pitfalls
Running Apache Spark on Kubernetes: Best Practices and PitfallsRunning Apache Spark on Kubernetes: Best Practices and Pitfalls
Running Apache Spark on Kubernetes: Best Practices and PitfallsDatabricks
 
Making Data Timelier and More Reliable with Lakehouse Technology
Making Data Timelier and More Reliable with Lakehouse TechnologyMaking Data Timelier and More Reliable with Lakehouse Technology
Making Data Timelier and More Reliable with Lakehouse TechnologyMatei Zaharia
 
Transparent Data Encryption
Transparent Data EncryptionTransparent Data Encryption
Transparent Data EncryptionJohn Magnabosco
 
Basic oracle-database-administration
Basic oracle-database-administrationBasic oracle-database-administration
Basic oracle-database-administrationsreehari orienit
 
Making Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeMaking Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeDatabricks
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overviewhonglee71
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresqlbotsplash.com
 
Intro to Delta Lake
Intro to Delta LakeIntro to Delta Lake
Intro to Delta LakeDatabricks
 
Spark with Delta Lake
Spark with Delta LakeSpark with Delta Lake
Spark with Delta LakeKnoldus Inc.
 
Physical architecture of sql server
Physical architecture of sql serverPhysical architecture of sql server
Physical architecture of sql serverDivya Sharma
 

Tendances (20)

Delta lake and the delta architecture
Delta lake and the delta architectureDelta lake and the delta architecture
Delta lake and the delta architecture
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
 
Performance Optimizations in Apache Impala
Performance Optimizations in Apache ImpalaPerformance Optimizations in Apache Impala
Performance Optimizations in Apache Impala
 
A Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiA Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and Hudi
 
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardDelta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
 
Presentation of Apache Cassandra
Presentation of Apache Cassandra Presentation of Apache Cassandra
Presentation of Apache Cassandra
 
Apache Iceberg: An Architectural Look Under the Covers
Apache Iceberg: An Architectural Look Under the CoversApache Iceberg: An Architectural Look Under the Covers
Apache Iceberg: An Architectural Look Under the Covers
 
Running Apache Spark on Kubernetes: Best Practices and Pitfalls
Running Apache Spark on Kubernetes: Best Practices and PitfallsRunning Apache Spark on Kubernetes: Best Practices and Pitfalls
Running Apache Spark on Kubernetes: Best Practices and Pitfalls
 
Making Data Timelier and More Reliable with Lakehouse Technology
Making Data Timelier and More Reliable with Lakehouse TechnologyMaking Data Timelier and More Reliable with Lakehouse Technology
Making Data Timelier and More Reliable with Lakehouse Technology
 
Transparent Data Encryption
Transparent Data EncryptionTransparent Data Encryption
Transparent Data Encryption
 
Basic oracle-database-administration
Basic oracle-database-administrationBasic oracle-database-administration
Basic oracle-database-administration
 
Apache Atlas: Governance for your Data
Apache Atlas: Governance for your DataApache Atlas: Governance for your Data
Apache Atlas: Governance for your Data
 
Sql server basics
Sql server basicsSql server basics
Sql server basics
 
Making Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta LakeMaking Apache Spark Better with Delta Lake
Making Apache Spark Better with Delta Lake
 
Oracle Database Overview
Oracle Database OverviewOracle Database Overview
Oracle Database Overview
 
AlwaysON Basics
AlwaysON BasicsAlwaysON Basics
AlwaysON Basics
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
 
Intro to Delta Lake
Intro to Delta LakeIntro to Delta Lake
Intro to Delta Lake
 
Spark with Delta Lake
Spark with Delta LakeSpark with Delta Lake
Spark with Delta Lake
 
Physical architecture of sql server
Physical architecture of sql serverPhysical architecture of sql server
Physical architecture of sql server
 

En vedette

Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...
Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...
Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...Cathrine Wilhelmsen
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architectureAjeet Singh
 
PMO OBjectives - a quick guide
PMO OBjectives - a quick guidePMO OBjectives - a quick guide
PMO OBjectives - a quick guidePM Majik
 
Introduction to microsoft sql server 2008 r2
Introduction to microsoft sql server 2008 r2Introduction to microsoft sql server 2008 r2
Introduction to microsoft sql server 2008 r2Eduardo Castro
 
Windows Server 2008 R2 Overview
Windows Server 2008 R2 OverviewWindows Server 2008 R2 Overview
Windows Server 2008 R2 OverviewAlexander Schek
 
MS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsMS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsDataminingTools Inc
 
Project Management Office (PMO)
Project Management Office (PMO)Project Management Office (PMO)
Project Management Office (PMO)Anand Subramaniam
 

En vedette (9)

Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...
Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...
Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
 
PMO OBjectives - a quick guide
PMO OBjectives - a quick guidePMO OBjectives - a quick guide
PMO OBjectives - a quick guide
 
Introduction to microsoft sql server 2008 r2
Introduction to microsoft sql server 2008 r2Introduction to microsoft sql server 2008 r2
Introduction to microsoft sql server 2008 r2
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
 
Windows Server 2008 R2 Overview
Windows Server 2008 R2 OverviewWindows Server 2008 R2 Overview
Windows Server 2008 R2 Overview
 
MS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsMS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database Concepts
 
Project Management Office (PMO)
Project Management Office (PMO)Project Management Office (PMO)
Project Management Office (PMO)
 

Similaire à Microsoft SQL Server - Files and Filegroups

Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3Ala Qunaibi
 
Big data interview questions and answers
Big data interview questions and answersBig data interview questions and answers
Big data interview questions and answersKalyan Hadoop
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OSC.U
 
Oracle & sql server comparison 2
Oracle & sql server comparison 2Oracle & sql server comparison 2
Oracle & sql server comparison 2Mohsen B
 
Os10
Os10Os10
Os10issbp
 
Dipping Your Toes: Azure Data Lake for DBAs
Dipping Your Toes: Azure Data Lake for DBAsDipping Your Toes: Azure Data Lake for DBAs
Dipping Your Toes: Azure Data Lake for DBAsBob Pusateri
 
SQL Server 2012 - FileTables
SQL Server 2012 - FileTables SQL Server 2012 - FileTables
SQL Server 2012 - FileTables Sperasoft
 
Hadoop File system (HDFS)
Hadoop File system (HDFS)Hadoop File system (HDFS)
Hadoop File system (HDFS)Prashant Gupta
 
Hadoop Distributed File System for Big Data Analytics
Hadoop Distributed File System for Big Data AnalyticsHadoop Distributed File System for Big Data Analytics
Hadoop Distributed File System for Big Data AnalyticsDrPDShebaKeziaMalarc
 
Big data with HDFS and Mapreduce
Big data  with HDFS and MapreduceBig data  with HDFS and Mapreduce
Big data with HDFS and Mapreducesenthil0809
 
Degonto file management
Degonto file managementDegonto file management
Degonto file managementDegonto Islam
 

Similaire à Microsoft SQL Server - Files and Filegroups (20)

Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3
 
6952234.ppt
6952234.ppt6952234.ppt
6952234.ppt
 
Big data interview questions and answers
Big data interview questions and answersBig data interview questions and answers
Big data interview questions and answers
 
Network data storage
Network data storageNetwork data storage
Network data storage
 
OSCh12
OSCh12OSCh12
OSCh12
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
 
Oracle & sql server comparison 2
Oracle & sql server comparison 2Oracle & sql server comparison 2
Oracle & sql server comparison 2
 
Os10
Os10Os10
Os10
 
Dipping Your Toes: Azure Data Lake for DBAs
Dipping Your Toes: Azure Data Lake for DBAsDipping Your Toes: Azure Data Lake for DBAs
Dipping Your Toes: Azure Data Lake for DBAs
 
Oracle tutorial
Oracle tutorialOracle tutorial
Oracle tutorial
 
module 2.pptx
module 2.pptxmodule 2.pptx
module 2.pptx
 
SQL Server 2012 - FileTables
SQL Server 2012 - FileTables SQL Server 2012 - FileTables
SQL Server 2012 - FileTables
 
Hadoop
HadoopHadoop
Hadoop
 
Hadoop File system (HDFS)
Hadoop File system (HDFS)Hadoop File system (HDFS)
Hadoop File system (HDFS)
 
Hadoop Distributed File System for Big Data Analytics
Hadoop Distributed File System for Big Data AnalyticsHadoop Distributed File System for Big Data Analytics
Hadoop Distributed File System for Big Data Analytics
 
Big data with HDFS and Mapreduce
Big data  with HDFS and MapreduceBig data  with HDFS and Mapreduce
Big data with HDFS and Mapreduce
 
Degonto file management
Degonto file managementDegonto file management
Degonto file management
 
Active Directory
Active DirectoryActive Directory
Active Directory
 
SNAW-Assignment.docx
SNAW-Assignment.docxSNAW-Assignment.docx
SNAW-Assignment.docx
 

Plus de Naji El Kotob

SSRS Report with Parameters and Data Filtration
SSRS Report with Parameters and Data FiltrationSSRS Report with Parameters and Data Filtration
SSRS Report with Parameters and Data FiltrationNaji El Kotob
 
Odoo - Educational Account for Students and Teachers Ver. 2.0
Odoo - Educational Account for Students and Teachers Ver. 2.0Odoo - Educational Account for Students and Teachers Ver. 2.0
Odoo - Educational Account for Students and Teachers Ver. 2.0Naji El Kotob
 
Google search - Tips and Tricks
Google search - Tips and TricksGoogle search - Tips and Tricks
Google search - Tips and TricksNaji El Kotob
 
tempdb and Performance Keys
tempdb and Performance Keystempdb and Performance Keys
tempdb and Performance KeysNaji El Kotob
 
Microsoft SQL Server 2012 Components and Tools (Quick Overview) - Rev 1.3
Microsoft SQL Server 2012 Components and Tools (Quick Overview) - Rev 1.3Microsoft SQL Server 2012 Components and Tools (Quick Overview) - Rev 1.3
Microsoft SQL Server 2012 Components and Tools (Quick Overview) - Rev 1.3Naji El Kotob
 
T-SQL Data Types (Quick Overview)
T-SQL Data Types (Quick Overview)T-SQL Data Types (Quick Overview)
T-SQL Data Types (Quick Overview)Naji El Kotob
 
Robots and-sitemap - Version 1.0.1
Robots and-sitemap - Version 1.0.1Robots and-sitemap - Version 1.0.1
Robots and-sitemap - Version 1.0.1Naji El Kotob
 
Practical MS SQL Introduction
Practical MS SQL IntroductionPractical MS SQL Introduction
Practical MS SQL IntroductionNaji El Kotob
 
MVC and Razor - Doc. v1.2
MVC and Razor - Doc. v1.2MVC and Razor - Doc. v1.2
MVC and Razor - Doc. v1.2Naji El Kotob
 

Plus de Naji El Kotob (9)

SSRS Report with Parameters and Data Filtration
SSRS Report with Parameters and Data FiltrationSSRS Report with Parameters and Data Filtration
SSRS Report with Parameters and Data Filtration
 
Odoo - Educational Account for Students and Teachers Ver. 2.0
Odoo - Educational Account for Students and Teachers Ver. 2.0Odoo - Educational Account for Students and Teachers Ver. 2.0
Odoo - Educational Account for Students and Teachers Ver. 2.0
 
Google search - Tips and Tricks
Google search - Tips and TricksGoogle search - Tips and Tricks
Google search - Tips and Tricks
 
tempdb and Performance Keys
tempdb and Performance Keystempdb and Performance Keys
tempdb and Performance Keys
 
Microsoft SQL Server 2012 Components and Tools (Quick Overview) - Rev 1.3
Microsoft SQL Server 2012 Components and Tools (Quick Overview) - Rev 1.3Microsoft SQL Server 2012 Components and Tools (Quick Overview) - Rev 1.3
Microsoft SQL Server 2012 Components and Tools (Quick Overview) - Rev 1.3
 
T-SQL Data Types (Quick Overview)
T-SQL Data Types (Quick Overview)T-SQL Data Types (Quick Overview)
T-SQL Data Types (Quick Overview)
 
Robots and-sitemap - Version 1.0.1
Robots and-sitemap - Version 1.0.1Robots and-sitemap - Version 1.0.1
Robots and-sitemap - Version 1.0.1
 
Practical MS SQL Introduction
Practical MS SQL IntroductionPractical MS SQL Introduction
Practical MS SQL Introduction
 
MVC and Razor - Doc. v1.2
MVC and Razor - Doc. v1.2MVC and Razor - Doc. v1.2
MVC and Razor - Doc. v1.2
 

Dernier

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 

Dernier (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

Microsoft SQL Server - Files and Filegroups

  • 1. Files and Filegroups Microsoft SQL Server Rev 1.0-1406 By Naji El Kotob naji [@] dotnetheroes.com www.DotNETHeroes.com
  • 2. Outlines  Introduction to SQL Server files Architecture  Understanding Pages and Extents  About Files and Filegroups  Primary and Secondary Filegroups  Using Files and Filegroups  Read-Only Filegroups  Rules for Designing Files and Filegroups  Recommendations  RAID?  FileGroup and RAID  Interactive in-class DEMO  QnA  References
  • 3. Database Sample  AdventureWorks 2012 Database  http://msftdbprodsamples.codeplex.com
  • 4. Understanding Pages and Extents  Pages  The fundamental unit of data storage in SQL Server is the page.  The disk space allocated to a data file (.mdf or .ndf) in a database is logically divided into pages numbered contiguously from 0 to n.  Disk I/O operations are performed at the page level.  SQL Server reads or writes whole data pages. In SQL Server, the page size is 8 KB. This means SQL Server databases have 128 pages per megabyte. Each page begins with a 96-byte header that is used to store system information about the page. http://technet.microsoft.com/en-us/library/ms190969(v=sql.105).aspx
  • 5. Understanding Pages and Extents  Extents  Extents are a collection of eight physically contiguous pages and are used to efficiently manage the pages. All pages are stored in extents.  Extents are the basic unit in which space is managed.  An extent is eight physically contiguous pages, or 64 KB. This means SQL Server databases have 16 extents per megabyte. A new table or index is generally allocated pages from mixed extents. When the table or index grows to the point that it has eight pages, it then switches to use uniform extents for subsequent allocations http://technet.microsoft.com/en-us/library/ms190969(v=sql.105).aspx
  • 6. Files and Filegroups  SQL Server maps a database over a set of operating-system files.  Data and log information are never mixed in the same file, and individual files are used only by one database.  Filegroups are named collections of files and are used to help with data placement and administrative tasks such as backup and restore operations. http://technet.microsoft.com/en-us/library/ms179316(v=sql.105).aspx
  • 7. Files default Extensions  .MDF = Master Database File  .LDF = Log Database File  .NDF = Secondary Database File
  • 8. Primary and Secondary Filegroups  A primary filegroup contains the primary datafile (mdf).  Tip: All system tables are allocated to the primary filegroup.  A secondary filegroup (also called a user-defined filegroup) contains secondary datafiles (ndf) and database objects.  The default filegroup contains objects which were created without an assigned filegroup.  Tip: The primary filegroup is the default filegroup unless another filegroup is specified.  Logfiles (.ldf) are never part of a filegroup.
  • 9. Using Files and Filegroups  File and Filegroup Fill Strategy  Filegroups use a proportional fill strategy across all the files within each filegroup.  For example, if file f1 has 100 MB free and file f2 has 200 MB free, one extent is allocated from file f1, two extents from file f2, and so on. In this way, both files become full at about the same time, and simple striping is achieved.  Improving Database Performance  Using files and filegroups improves database performance, because it lets a database be created across multiple disks, multiple disk controllers, or RAID (redundant array of independent disks) systems.  Implementing Backup and Restore Strategies  Databases made up of multiple filegroups can be restored in stages by a process known as piecemeal restore.
  • 10. Read-Only Filegroups  Any existing filegroup, except the primary filegroup, can be marked as read- only.  A filegroup marked read-only cannot be modified in any way.  Tip: For tables that must not be modified, such as historical data, put them on filegroups and then mark the filegroup as read-only. This prevents accidental updates.
  • 11. Rules for Designing Files and Filegroups  The following rules pertain to files and filegroups:  A file or filegroup cannot be used by more than one database. For example, file sales.mdf and sales.ndf, which contain data and objects from the sales database, cannot be used by any other database.  A file can be a member of only one filegroup.  Transaction log files are never part of any filegroups.
  • 12. Files and Filegroups Recommendations  Most databases will work well with a single data file and a single transaction log file.  If you use multiple files, create a second filegroup for the additional file and make that filegroup the default filegroup.  Tip: In this way, the primary file will contain only system tables and objects.  To maximize performance, create files or filegroups on as many different available local physical disks as possible.  Tip: Put objects that compete heavily for space in different filegroups.  Use filegroups to enable placement of objects on specific physical disks.  Put different tables used in the same join queries in different filegroups.  Tip: This will improve performance, because of parallel disk I/O searching for joined data.  Put heavily accessed tables and the nonclustered indexes that belong to those tables on different filegroups.  Tip: This will improve performance, because of parallel I/O if the files are located on different physical disks.  Do not put the transaction log file or files on the same physical disk that has the other files and filegroups. For more info http://technet.microsoft.com/en-us/library/ms187087(v=sql.105).aspx
  • 14. FileGroup VS. RAID  The best performance of your SQL Server database is to combine both multiple Files/Filegroups and hardware RAID together.  E.g.  4 disks in a RAID-10 array for the data.  2 disks using RAID-1 (mirroring) for the transaction log.  1 disk for the non-clustered indexes
  • 15. Q&A  Please send your feedback to naji [@] dotnetheroes.com
  • 16. References  http://technet.microsoft.com/en-us/library/ms179316(v=sql.105).aspx (File and Filegroups Architecture)  http://www.prepressure.com/library/technology/raid  http://macperformanceguide.com/Storage-RAID1-speed.html