VMWare CPU Limit effect on VM computing and disk speed – CPU stolen time

Symptoms:
Customer complaining about slow SQL server and event application timeout.
Hihg CPU usage and slow disk with bad disk time response.
Let’s check the the 4 CPU core:
Hihg CPU usage at night

At first glance, it seemed like a heavily used server.
The lack of server resources caused timeouts for the applications.

I suspect VMWare virtualization cause performance issue:

VMWare Virtualization CPU Stolen time
CPU Stolen time is high

Thanks for the teamwork, we found the settings which caused a poor performance: Continue reading “VMWare CPU Limit effect on VM computing and disk speed – CPU stolen time”

DBATools – powershell

Taking notes – some example:

Download and Install to my computer:

https://dbatools.io/download/

­

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

Install-Module dbatools

if necessary:
update-module dbatools

OFFLINE:

Copy this directory to offline server:
C:\Program Files\WindowsPowerShell\Modules\dbatools

Set-Location ‘C:\Program Files\WindowsPowerShell\Modules\dbatools’ ##.\install.ps1  ## with internet access
Get-ChildItem -Recurse | Unblock-File

Continue reading “DBATools – powershell”

Install SQL Server 2019 Developer Edition

Install SQL Server 2019 Developer Edition – download ISO image and install it offline.

You can download the installer file from:

SQL Developer Edition
SQL Developer Edition

Start the downloaded SQL2019-SSEI-Dev.exe  in an administrator command prompt with the following parameter:

So you can download the ISO image:

SQL Server Developer Edition ISO image download
SQL Server Developer Edition ISO image download

 

Test your MAXDOP – SQL Server max degree of parallelism

The default value of your SQL server is MAXDOP=0. It means there is no limit for parallelism. Your query can use all of your CPU core.

Scenario:
If your SQL Server is not used, than your CPU utilization is low,
your query can use all of the server’s resources.
I run a cross join query in a table which has 40.000 rows.
The server has 8 core.
I set hint for the query to simulate the MAXDOP server setting.

The query and the result:

So if your query use only 1 thread it run longer ( in the example 232 seconds), if it use 8 thread it run much more quicker ( 33 seconds).
So 232/33 ~= 7 . Ok the speed is not 8x , but almost 8. The operating system and other processes use system resources.

Should we use the maxdop value without limit? In the real life a lot of queries run at the same time, so if your query get all of the resource the other waiting the resources. So you try to figure out what is ideal value?
If you have no idea, or don’t have experience with the new databases , you can set the recommended value:
https://support.microsoft.com/en-us/help/2806535/recommendations-and-guidelines-for-the-max-degree-of-parallelism-confi

Server Propertis - MAXDOP
Server Propertis – MAXDOP

You can reduce the parallelism in your server with increasing the Cost Threshold for Parallelims.

You can set it for individually for every database:

Database settings
Database settings

Max DOP for you database and Max DOP For Secondary for your Always ON AG secondary replicas.

How to Check Index Fragmentation and Partitioned Table Index Fragmentation

I use two script. The firs one is for general purpose and run faster, the second one is good for partitioned table and get many details about partitioned index and table.

Detailed query for partitioned table:

SQL Server 2019 Administration Inside Out

SQL Server 2019 Administration Inside Out Paperback – release date: 2020 by Randolph West, Melody Zacharias, William Assaf, Sven Aelterman

sql server 2019 book

Conquer SQL Server 2019 administration–from the inside out

Dive into SQL Server 2019 administration–and really put your SQL Server DBA expertise to work. This supremely organized reference packs hundreds of time-saving solutions, tips, and workarounds–all you need to plan, implement, manage, and secure SQL Server 2019 in any production environment: on-premises, cloud, or hybrid. SQL Server experts offer a complete tour of DBA capabilities available in SQL Server 2019 Database Engine, SQL Server Data Tools, SQL Server Management Studio, and via PowerShell. Discover how experts tackle today’s essential tasks–and challenge yourself to new levels of mastery.

  • Install, customize, and use SQL Server 2019’s key administration and development tools
  • Manage memory, storage, clustering, virtualization, and other components
  • Architect and implement database infrastructure, including IaaS, Azure SQL, and hybrid cloud configurations
  • Provision SQL Server and Azure SQL databases
  • Secure SQL Server via encryption, row-level security, and data masking
  • Safeguard Azure SQL databases using platform threat protection, firewalling, and auditing
  • Establish SQL Server IaaS network security groups and user-defined routes
  • Administer SQL Server user security and permissions
  • Efficiently design tables using keys, data types, columns, partitioning, and views
  • Utilize BLOBs and external, temporal, and memory-optimized tables
  • Master powerful optimization techniques involving concurrency, indexing, parallelism, and execution plans
  • Plan, deploy, and perform disaster recovery in traditional, cloud, and hybrid environments

For Experienced SQL Server Administrators and Other Database Professionals

Adatbázis méret csökkentése – Shrink a Database

Adatbázis fájlok méretét ritkán csökkentjük, hiszen többnyire úgy is megtelik új adatokkal , indexekkel. Érdemes csökkenteni a méretet például ha nagyon sok adatot kipucoltunk az adatbázisból és csak nagyon sokára fog újra felhízni..

Az adatábzis méretet mindig óvatosan csökkentsük, lehet hogy 500 MB üres terület kivétele pillanatok alatt , pár másodperc alatt megtörténik, majd máskor az adatok áthelyezése miatt percekig fut akárcsak 1 MB átszervezése.

Javaslat: kisebb MB-ok csökkentésével kezdjük, majd növeljük a shrink méretet. Amikor elkezd nőni a végrehajtási idő , akkor csökkentsük a shrink méretet.

Adatbázis audit

DevOps környezetben vagy éles környezetben érdemes auditot beállítani. Saját érdekünkben érdemes tudni, hogy ki nyúlt bele és mit csinált!


Nem használt oszlopok – Empty columns

Default Null értékű oszlopok , ahol minden Null értékű:

 

Table size

Tábla méretek , használt tartalommal: