Saturday, April 15, 2023

Recovery Model in Microsoft SQL Server

In SQL Server, the recovery model is a very important concept or we can say, it is a configuration setting in which the system defines how the transaction log is used to recover the database at the time of any issue in the database.

SQL server has three recovery models for databases: 

    i) Simple, 

    ii) Full and 

    iii) Bulk-logged. 

Every recovery model has advantages and disadvantages.

To decide on the recovery model of any new database, we need to consider specific requirements and needs for the application.

Friday, April 14, 2023

Components of SQL server / Database Engine in Microsoft SQL Server


Microsoft SQL Server is a well known RDBMS & is used to manage large amounts of data. 

The Database Engine is the core component of SQL Server.

The Database Engine stores data, process as per requirement and also prevent the data from external threads and vulnerability.

This article will give you the idea about various components of the SQL server / database engine, idea of internal processes and their work.

1. Query Optimiser:-
The responsible of query optimiser is to generate Optimised Execution Plan for the queries.
Query Optimiser analyses query and generates multiple execution plan which are evaluated on the basis of cost and performance characteristics.
After that Query Optimiser selects best Execution Plan & executes the query.  
The optimiser considers available resources, workload, statistics and indexes during the estimation of query cost.
2. Query Processor:-
Query Processor executes all SQL queries & return results to end user.
When we run a query, goes through multiple phases like cmd parsing, optimisation and execution.
    a) CMD Parshing:-
    In Parshing Phase, it checks syntax & semantics of the query and in case of     any error, throws message to the end user.
Syntax Error
    b) Optimiser:- Query Optimiser is very important part of SQL Server.
It is also very complex and secret part of SQL server. 
This phase generates an optimised execution plan for the query.
Also known as "Cost-Based" optimiser. It means, Optimiser will check the best query plan which should be cost effective also.
Optimiser always tries to find best plan for the query to execute & fetch the result.
It works in three search phases:
    i) 0th Phase - In this phase, looks for nested loop joins.
    It stops if the cost of the plan is <0.2. The outcome plan from phase is             known as transaction processing  or TP Plan.
    ii) 1st Phase - Looks for common patterns. It stops if the cost of plan is             <1.0. The outcome plan from phase is known as quick plan.
    iii) 2nd Phase - Looks at parallelism & indexed views. 
 
   c) Query Executor:- In this phase, it executes the query & fetches the data     from database and returns the results to the end user.
    During the execution of query, it uses query plan & takes help of storage        engine.
Execute Of Query
3. Storage Engine:-
Storage Engine helps to store and retrieves data from storage devices. It also manages the data files and indexes which are used to store and organise data. Storage engine also manages concurrency which ensures multiple users can access & modify the same data without any conflicts.
It uses multiple algorithms to optimise data storage and retrieve data smoothly. 
Storage Engine

a) Access Method:-
Access method provides storage structure for our data & indexes and also provides interface to access the data as well as modify the required data.
Actually it sends request to Buffer Manager to fetch the required data.

b) Transaction Manager:-
Basically, transaction manager is having two components which are as follows:
i) Lock Manager - Manages concurrency for the data.
ii) Log Manager - It writes the changes in the transaction log which is also known as Write-Ahead Logging.

c) Buffer Manager:-
Buffer Manager handles buffer pool.
Suppose, we want to read few rows. Buffer Manager checks whether the required data is available in buffer pool/cache or not. If it is available, the required data are returned back to access method. Suppose the requested data is not available in buffer pool/cache, Buffer Manager fetches the data from the disk & stores it in the buffer pool/cache and returns the data to Access Method.









More coming Soon.....

Thursday, April 13, 2023

Pre-Requisites for Different Version of Microsoft SQL Server on Single Page


This article will give you a complete idea on the prerequisites to install Microsoft SQL Server. 

This will cover different versions of SQL Server starting from 2012 to 2022. 

It will give you knowledge of the minimum hardware & software requirements to install MS SQL Server.

The hardware requirement is given below for all major SQL Server versions:

Hardware Requirements
 
Hard Disk
Min. Memory
Express Edition
Min. Memory
All Other Editions
SQL Server 2012
Around 4 GB
512 MB
1 GB
SQL Ser. 2012 R2
Around 4 GB
512 MB
1 GB
SQL Server 2014
Around 4 GB
512 MB
1 GB
SQL Server 2016
Around 6 GB
512 MB
1 GB
SQL Server 2017
Around 6 GB
512 MB
1 GB
SQL Server 2019
Around 6 GB
512 MB
1 GB
SQL Server 2022
Around 6 GB
512 MB
1 GB
Hardware Requirement Table-1

Hardware Requirements
 
Memory Recommended
Express Edition
Memory Recommended
All Other Editions
SQL Server 2012
1 GB
At least 4 GB
SQL Ser. 2012 R2
1 GB
At least 4 GB
SQL Server 2014
1 GB
At least 4 GB
SQL Server 2016
1 GB
At least 4 GB
SQL Server 2017
1 GB
At least 4 GB
SQL Server 2019
1 GB
At least 4 GB
SQL Server 2022
1 GB
At least 4 GB
Hardware Requirement Table-2

Hardware Requirements
 
Minimum - Processor Speed
Recommended - Processor Speed
SQL Server 2012
1 GHz-32 bit & 1.4 GHz-64 bit
2.0 GHz
SQL Ser. 2012 R2
1 GHz-32 bit & 1.4 GHz-64 bit
2.0 GHz
SQL Server 2014
1 GHz-32 bit & 1.4 GHz-64 bit
2.0 GHz
SQL Server 2016
1.4 GHz-64 bit
2.0 GHz or Faster
SQL Server 2017
1.4 GHz-64 bit
2.0 GHz or Faster
SQL Server 2019
1.4 GHz-64 bit
2.0 GHz or Faster
SQL Server 2022
1.4 GHz-64 bit
2.0 GHz or Faster
Hardware Requirement Table-3




Software requirement is given below for all major SQL Server versions:

Featured Post

Use DBCC SQLPerf (logspace)

 Use DBCC SQLPerf (logspace) to monitor and optimize database performance in SQL Server. Let's Explore: Let's Explore: https://mades...

Popular Posts