Skip to content

About

คอร์ส SQL Server Performance Tuning ฉบับภาษาไทย พร้อมสคริปต์ DMVs, Workload และ Labs สำหรับฝึกวิเคราะห์และปรับปรุงประสิทธิภาพ SQL Server 2019/2022/2025

Resources

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Server Performance Tuning and Optimizing

SQL Server License Status

คอร์ส SQL Server Performance Tuning ฉบับภาษาไทย
เนื้อหาถูกเรียบเรียงมาจาก Microsoft Course 10987C โดยมีการปรับปรุงเนื้อหาและสคริปต์ให้ทันสมัย

📖 เริ่มต้นใช้งาน • 📚 โครงสร้างบทเรียน • 🗓️ ตารางอบรม 4 วัน • 🤝 Credits


📋 ภาพรวม (Overview)

คอร์สนี้ครอบคลุมการปรับปรุงประสิทธิภาพ SQL Server ตั้งแต่พื้นฐานสถาปัตยกรรมไปจนถึงเทคนิคขั้นสูง โดยเน้นการใช้งาน Dynamic Management Views (DMVs), Extended Events, และเครื่องมือวินิจฉัยสมัยใหม่

การจัดอบรมโดย Trainocate: หลักสูตร 4 วัน (24 ชั่วโมง) ตาม Outline อย่างเป็นทางการ — ดูตารางเวลารายวัน, วัตถุประสงค์ และแผนการสอนฉบับเต็มได้ที่ Trainer_Docs/Course_Guide_4Days.md

✨ คุณสมบัติหลัก

  • ✅ 11 Modules ตรงตาม Outline หลักสูตร (บทที่ 1–11) ครอบคลุมทุกด้านของ Performance Tuning
  • ✅ Modern Scripts อัปเดตตาม SQL Server 2025 — Optimized Locking, IQP รุ่นใหม่ (OPPO, CE Feedback), Query Store ล่าสุด, TempDB ADR/Governance
  • ✅ Hands-on Labs รูปแบบ Instruction + Code block — ทุก Step รันได้ทันทีจากเอกสารเดียว
  • ✅ Workload Scripts สำหรับทดสอบและสาธิต
  • ✅ Best Practices จาก Microsoft Learn (Performance Hub), Course 10987C, Glenn Berry Diagnostic Queries (SQL Server 2025) และเครื่องมือชุมชน — First Responder Kit, PSBlitz

📚 โครงสร้างบทเรียน (Course Structure)

Module หัวข้อ คำอธิบาย ระดับ
00 เริ่มจากศูนย์ (Getting Started) ศัพท์แกน DMV/Wait/Scheduler/Plan + Query แรก สำหรับผู้เรียนฐาน admin+query ⭐
01 Architecture, Scheduling, and Waits เข้าใจการทำงานของ SQLOS, Schedulers และ Wait Stats ⭐⭐⭐
02 I/O Subsystem การวัดผลและการจัดการ I/O Latency ⭐⭐⭐
03 Database Structures Data Files, Log Files, VLFs และ TempDB ⭐⭐
04 Memory Buffer Pool, Page Life Expectancy และการตั้งค่า Memory ⭐⭐⭐
05 Concurrency Locking, Blocking, Isolation Levels และ Deadlocks ⭐⭐⭐⭐
06 Statistics and Indexes Index Fragmentation, Missing Indexes และ Statistics ⭐⭐⭐⭐
07 Query Execution การอ่าน Execution Plan และปัญหา Performance Killers ⭐⭐⭐⭐
08 Plan Caching Plan Bloat, Recompilation และ Parameterization ⭐⭐⭐
09 Extended Events การใช้งาน XEvents แทน Profiler ⭐⭐⭐
10 Monitoring and Baselines การทำ Performance Baseline ด้วย PerfMon ⭐⭐⭐
11 Troubleshooting สรุปแนวทางการวิเคราะห์ปัญหา ⭐⭐⭐⭐⭐

🗓️ ผังการอบรม 4 วัน (24 ชั่วโมง)

วัน หัวข้อ บทที่
วันที่ 1 Architecture & I/O Foundation 1–3
วันที่ 2 Memory, Concurrency & Index 4–6
วันที่ 3 Query Processing & Plan Management 7–9
วันที่ 4 Monitoring, Tuning Strategy & Troubleshooting 10–11 + Case Study

ตารางเวลาละเอียดรายชั่วโมง → Trainer_Docs/Course_Guide_4Days.md


🚀 การใช้งาน (Usage)

โครงสร้างโฟลเดอร์

อ่านเป็นลำดับเหมือนหนังสือ — แต่ละโมดูลแบ่งเป็น Sections ย่อย สคริปต์อยู่กับหัวข้อที่เกี่ยวข้อง:

Module_XX_Topic/
├── README.md                     # 📖 สารบัญโมดูล: บทนำ + สารบัญ Sections + Quiz
├── Sections/
│   ├── 01_Topic_Name/
│   │   ├── README.md             # 📖 เนื้อหาบทเรียนแบบหนังสือ
│   │   └── Scripts/              # 🧪 สคริปต์ที่เกี่ยวข้องกับ section นี้
│   ├── 02_Topic_Name/ ...
└── Labs/
    └── README.md                 # 🧪 แล็บรวมประจำโมดูล (Instruction + Code block)

Prerequisites

ข้อกำหนด รายละเอียด
SQL Server 2025 (แนะนำ) หรือ 2019/2022 — ฟีเจอร์เฉพาะรุ่นมีหมายเหตุกำกับ
Database AdventureWorks2025 (แนะนำ) — บน SQL Server 2019/2022 ใช้ AdventureWorks2022
Permissions VIEW SERVER STATE, VIEW DATABASE STATE
Tools SSMS 20/21, DiskSpd, Query Store, Extended Events

ขั้นตอนการเริ่มต้น

  1. Clone Repository

    git clone https://github.com/yourusername/MS-SQL-Server-Performance-Tuning.git
    cd MS-SQL-Server-Performance-Tuning
  2. Setup Database

    • ดาวน์โหลด AdventureWorks2025.bak แล้ว Restore (วิธีทำจาก Microsoft Learn) — หากใช้ SQL Server 2019/2022 ให้ใช้ AdventureWorks2022.bak และแก้ชื่อ DB ในสคริปต์
    • Restore database ลงใน SQL Server instance ของคุณ
  3. Verify Setup

    • ตรวจสอบความพร้อมของระบบก่อนเริ่มเรียน
    • ตรวจความพร้อมด้วย Module_10_Monitoring_Tracing/Labs/Scripts/04_Daily_Health_Check.sql
  4. เริ่มเรียน

    • เริ่มจาก Module 01 เพื่อเข้าใจพื้นฐาน
    • ทำตาม Demo Scripts ก่อน แล้วค่อยทำ Labs

📖 แนวทางการเรียนรู้ (Learning Path)

🎯 สำหรับผู้เริ่มต้น

  1. Module 01 → Module 02 → Module 03 → Module 04
  2. เน้นทำความเข้าใจพื้นฐานก่อน

🎯 สำหรับผู้มีประสบการณ์

  1. Module 05 → Module 06 → Module 07
  2. เน้นการวิเคราะห์และแก้ไขปัญหาจริง

🎯 สำหรับผู้เชี่ยวชาญ

  1. Module 08 → Module 09 → Module 10 → Module 11
  2. เน้นเทคนิคขั้นสูงและการทำ Baseline

🛠️ สคริปต์ที่ใช้ (Scripts Overview)

Section Scripts (Sections/*/Scripts/)

สคริปต์อยู่คู่กับหัวข้อที่เกี่ยวข้อง — เปิด section ไหนก็เจอสคริปต์ของหัวข้อนั้น

  • Workload Scripts (Workload_*.sql): สร้างโหลดจำลอง (CPU / I/O / Blocking) เพื่อให้แล็บเห็นปัญหาจริง

  • Diagnostic Scripts: สคริปต์วิเคราะห์เชิงลึก (หลายไฟล์อ้างอิง Glenn Berry Diagnostic Queries)

  • คู่มือแล็บรวมต่อโมดูล: Labs/README.md แบบ Instruction + Code block

  • เครื่องมือระดับมืออาชีพ: คู่มือภาษาไทยของ Glenn Berry Diagnostics, First Responder Kit, PSBlitz และ Tiger Toolbox รวมอยู่ที่ Advanced_Scripts/README.md

  • Hands-on Exercises: ฝึกปฏิบัติตามสถานการณ์จริง

  • Challenge Scripts: ทดสอบความเข้าใจด้วยปัญหาที่ซับซ้อน


📊 สถิติ Repository

  • Total Modules: 11
  • Total Scripts: 100+ SQL scripts
  • Workload Scripts: 15+
  • Lab Exercises: 41 (11 Labs)

🤝 Credits

Original Course

  • Microsoft Course 10987C: Performance Tuning and Optimizing SQL Server

Additional Resources

  • Glenn Berry: SQL Server Diagnostic Information Queries — อัปเดตรายเดือน มีรุ่นสำหรับ SQL Server 2025
  • Brent Ozar — First Responder Kit: ชุด sp_Blitz* เครื่องมือวินิจฉัย open source ที่วงการใช้แพร่หลายที่สุด
  • PSBlitz (VladDBA): วินิจฉัยแบบรายงานเดียวจบ (HTML/Excel) โดยไม่ต้องติดตั้งอะไรบนเซิร์ฟเวอร์เป้าหมาย
  • SQLSkills: Wait Statistics Library
  • Microsoft Learn: Monitor and Tune for Performance — Performance Hub ทางการ
  • r/SQLServer: ชุมชนแลกเปลี่ยนเคสจริง เครื่องมือใหม่ และประสบการณ์หน้างาน

License

This repository is for educational purposes. Scripts are provided as-is with attribution to original authors.


📝 License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Disclaimer

สคริปต์ใน Repository นี้จัดทำขึ้นเพื่อวัตถุประสงค์ทางการศึกษาเท่านั้น
กรุณาใช้ความระมัดระวัง เมื่อรันสคริปต์บน Production Environment


⭐ ถ้าคุณพบว่าคอร์สนี้มีประโยชน์ กรุณา Star Repository นี้ ⭐

Made with ❤️ for the SQL Server Community

About

คอร์ส SQL Server Performance Tuning ฉบับภาษาไทย พร้อมสคริปต์ DMVs, Workload และ Labs สำหรับฝึกวิเคราะห์และปรับปรุงประสิทธิภาพ SQL Server 2019/2022/2025

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages