Database TestingSiva Kotilingam PallikondaThe document provides an overview of different types of database testing including front end database testing, structural backend testing, functional backend testing, database migration testing, data warehouse testing, and batch job execution testing. It describes the key aspects to test for each type, such as verifying database schemas, stored procedures, triggers, data integrity, security, performance, and more. Screenshots are also included to exemplify some of the testing processes.
12. oracle database architectureAmrit KaurAn Oracle database consists of physical files on disk that store data and logical memory structures that manage the files. The database is made up of data files that contain tables and indexes, control files that track the physical components, and redo log files that record changes. The instance in memory associates with one database and manages access through background processes. The database is divided into logical storage units called tablespaces that map to the physical data files. Common tablespaces include SYSTEM, SYSAUX, undo and temporary tablespaces.
Full Text Search In PostgreSQLKarwin Software Solutions LLCA comparison of different solutions for full-text search in web applications using PostgreSQL and other technology. Presented at the PostgreSQL Conference West, in Seattle, October 2009.
Basic oracle-database-administrationsreehari orienitBest Oracle Institute: orienit is the best Oracle Training Institutes in Hyderabad. Providing Oracle Training by real time faculty in Hyderabad.
Oracle Table Partitioning - IntroductionMyOnlineITCoursesIntroduction to Oracle Table partitioning .Covers information about " What , Why, When , How" aspects of Oracle Table partitioning.
Apache Arrow Flight: A New Gold Standard for Data TransportWes McKinneyThis document discusses how structured data is often moved inefficiently between systems, causing waste. It introduces Apache Arrow, an open standard for in-memory data, and how Arrow can help make data movement more efficient. Systems like Snowflake and BigQuery are now using Arrow to help speed up query result fetching by enabling zero-copy data transfers and sharing file formats between query processing and storage.
ETL Testing Training PresentationApurba BiswasThe document discusses ETL (extract, transform, load) which is a process used to clean and prepare data from various sources for analysis in a data warehouse. It describes how ETL extracts data from different source systems, transforms it into a uniform format, and loads it into a data warehouse. It also provides examples of ETL tools, the purpose of ETL testing including testing for data accuracy and integrity, and SQL queries commonly used for ETL testing.
AlwaysON BasicsHarsh ChawlaThis document summarizes AlwaysOn availability groups in SQL Server 2016. It discusses how AlwaysOn works, the components of an availability group like primary and secondary replicas, and prerequisites for setting up AlwaysOn. It also provides an overview of a demo that will configure high availability with AlwaysOn and how backups can be performed on secondary replicas.
SQL Server High Availability and Disaster RecoveryMichael PorembaHigh availability and disaster recovery strategies for Microsoft SQL Server databases are discussed. Key points include:
1) High availability aims to minimize downtime through redundant components and automatic failover, while disaster recovery protects against total data center outage through redundant systems and facilities.
2) Various SQL Server high availability options are examined, including database mirroring, log shipping, and failover clustering, each with different capabilities like automatic failover speed and hardware requirements.
3) Disaster recovery focuses on having a redundant system in a separate location that can be switched over to if the primary system fails. It requires strategies for backup, offsite storage, and recovery of data at the redundant location.
SQL Server Performance Tuning Baseline► Supreme Mandal ◄This document provides an overview of performance monitoring and optimization for SQL Server databases. It discusses monitoring database activity using tools like SQL Profiler and Activity Monitor, identifying bottlenecks, using the Database Engine Tuning Advisor to generate optimization recommendations, and addressing issues related to processes, locking, and deadlocks. Best practices emphasized establishing a performance baseline, making incremental changes while measuring impact, and focusing on specific issues to optimize real-world workloads.
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Aaron ShiloThe document provides an overview of Oracle database performance tuning best practices for DBAs and developers. It discusses the connection between SQL tuning and instance tuning, and how tuning both the database and SQL statements is important. It also covers the connection between the database and operating system, how features like data integrity and zero downtime updates are important. The presentation agenda includes topics like identifying bottlenecks, benchmarking, optimization techniques, the cost-based optimizer, indexes, and more.
Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...Cathrine WilhelmsenThe document provides an introduction to table partitioning in SQL Server. It explains what a partitioned table is, the key components like partition key, partition function, and partition scheme. It discusses why table partitioning is used, including benefits like partition elimination to improve query performance, ability to backup and restore partitions individually, and perform maintenance tasks like indexing and statistics updates on partitions. It also covers techniques like partition switching which allows fast loading and archiving of data without physically moving it. The document uses examples and diagrams to illustrate these concepts and components of table partitioning.
MySQL Architecture and EngineAbdul ManafMySQL uses different storage engines to store, retrieve and index data. The major storage engines are MyISAM, InnoDB, MEMORY, and ARCHIVE. MyISAM uses table-level locking and supports full-text searching but not transactions. InnoDB supports transactions, row-level locking and foreign keys but with more overhead than MyISAM. MEMORY stores data in memory for very fast access but data is lost on server restart. ARCHIVE is for read-only tables to improve performance and reduce storage requirements.
Always on in sql server 2017Gianluca HotzThis document discusses AlwaysOn availability technologies in SQL Server 2017, including Failover Cluster Instances (FCI) and Availability Groups (AG). It provides an overview of how FCI and AG work to provide high availability and disaster recovery, including capabilities like multi-subnet support. The document also summarizes new features and enhancements to FCI and AG in SQL Server 2014, 2016 and 2017.
Microsoft SQL Server internals & architectureKevin KlineFrom noted SQL Server expert and author Kevin Kline - Let’s face it. You can effectively do many IT jobs related to Microsoft SQL Server without knowing the internals of how SQL Server works. Many great developers, DBAs, and designers get their day-to-day work completed on time and with reasonable quality while never really knowing what’s happening behind the scenes. But if you want to take your skills to the next level, it’s critical to know SQL Server’s internal processes and architecture. This session will answer questions like:
- What are the various areas of memory inside of SQL Server?
- How are queries handled behind the scenes?
- What does SQL Server do with procedural code, like functions, procedures, and triggers?
- What happens during checkpoints? Lazywrites?
- How are IOs handled with regards to transaction logs and database?
- What happens when transaction logs and databases grow or shrinks?
This fast paced session will take you through many aspects of the internal operations of SQL Server and, for those topics we don’t cover, will point you to resources where you can get more information.
The Complete MariaDB Server tutorialColin CharlesPresented at Percona Live Amsterdam 2016, this is an in-depth look at MariaDB Server right up to MariaDB Server 10.1. Learn the differences. See what's already in MySQL. And so on.
Welcome To The 2016 Query Store!SolarWindsOne of our favorite new features in SQL Server 2016 is the Query Store. The Query Store houses valuable information on performance of your queries as well as gives you great insights into your query workload. This presentation will take a look at the Query Store, how it works and the type of information it holds.
High Concurrency Architecture at TIKINghia MinhThis document discusses high concurrency architectures at TIKI. It describes Pegasus, the highest throughput API, which uses caching, compression, and a non-blocking architecture to handle over 200k requests per minute with sub-2ms latency. It also describes Arcturus, the high concurrency inventory API, which uses an in-memory ring buffer, Kafka for ordering, and asynchronous database flushing to handle millions of inventory transactions per second with eventual consistency. Key techniques discussed include non-blocking designs, caching, compression, ordering queues, and asynchronous data replication.
MariaDB Galera Cluster presentationFrancisco GonçalvesThis document provides an overview and summary of various high availability (HA) solutions for MySQL databases. It begins with an introduction to HA and definitions of key terms. It then discusses MySQL replication, including asynchronous, semi-synchronous, and features in MySQL 5.6 and MariaDB 10.0. Other HA solutions covered include MHA for automated failover, Galera/MariaDB Galera Cluster for synchronous replication, shared disk solutions like DRBD, and MySQL Cluster for in-memory synchronous replication across nodes. The document provides brief descriptions of how each solution works and when it may be applicable.
SQL Server Database Backup and Restore PlanHamid J. FardIt describes how DBA needs to design and implement backup and restore plans in SQL Server based on agreed RTO and RPO.
Sql server basicsVishalJharwadeThe document provides an overview of SQL Server including:
- The architecture including system databases like master, model, msdb, and tempdb.
- Recovery models like full, bulk-logged, and simple.
- Backup and restore options including full, differential, transaction log, and file group backups.
- T-SQL system stored procedures for administration tasks.
- SQL commands and functions.
- SQL Agent jobs which are scheduled tasks consisting of steps to perform automated tasks.
Introduction to Galera ClusterCodership Oy - Creators of Galera Cluster- Galera is a MySQL clustering solution that provides true multi-master replication with synchronous replication and no single point of failure.
- It allows high availability, data integrity, and elastic scaling of databases across multiple nodes.
- Companies like Percona and MariaDB have integrated Galera to provide highly available database clusters.
Bai 11Hồng Hải Đàm QuangPháp chứng kỹ thuật số cung cấp cho sinh viên với một cách tiếp cận có hệ thống khi tiến hành một điều tra pháp chứng máy tính (cả hai loại điều tra công quyền và điều tra công ty), các yêu cầu của một phòng thí nghiệm pháp chứng máy tính bao gồm cả thiết bị phục hồi dữ liệu, phần cứng và phần mềm cần thiết để xác nhận pháp chứng kỹ thuật số trong phòng thí nghiệm.
AlwaysON BasicsHarsh ChawlaThis document summarizes AlwaysOn availability groups in SQL Server 2016. It discusses how AlwaysOn works, the components of an availability group like primary and secondary replicas, and prerequisites for setting up AlwaysOn. It also provides an overview of a demo that will configure high availability with AlwaysOn and how backups can be performed on secondary replicas.
SQL Server High Availability and Disaster RecoveryMichael PorembaHigh availability and disaster recovery strategies for Microsoft SQL Server databases are discussed. Key points include:
1) High availability aims to minimize downtime through redundant components and automatic failover, while disaster recovery protects against total data center outage through redundant systems and facilities.
2) Various SQL Server high availability options are examined, including database mirroring, log shipping, and failover clustering, each with different capabilities like automatic failover speed and hardware requirements.
3) Disaster recovery focuses on having a redundant system in a separate location that can be switched over to if the primary system fails. It requires strategies for backup, offsite storage, and recovery of data at the redundant location.
SQL Server Performance Tuning Baseline► Supreme Mandal ◄This document provides an overview of performance monitoring and optimization for SQL Server databases. It discusses monitoring database activity using tools like SQL Profiler and Activity Monitor, identifying bottlenecks, using the Database Engine Tuning Advisor to generate optimization recommendations, and addressing issues related to processes, locking, and deadlocks. Best practices emphasized establishing a performance baseline, making incremental changes while measuring impact, and focusing on specific issues to optimize real-world workloads.
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...Aaron ShiloThe document provides an overview of Oracle database performance tuning best practices for DBAs and developers. It discusses the connection between SQL tuning and instance tuning, and how tuning both the database and SQL statements is important. It also covers the connection between the database and operating system, how features like data integrity and zero downtime updates are important. The presentation agenda includes topics like identifying bottlenecks, benchmarking, optimization techniques, the cost-based optimizer, indexes, and more.
Table Partitioning in SQL Server: A Magic Solution for Better Performance? (P...Cathrine WilhelmsenThe document provides an introduction to table partitioning in SQL Server. It explains what a partitioned table is, the key components like partition key, partition function, and partition scheme. It discusses why table partitioning is used, including benefits like partition elimination to improve query performance, ability to backup and restore partitions individually, and perform maintenance tasks like indexing and statistics updates on partitions. It also covers techniques like partition switching which allows fast loading and archiving of data without physically moving it. The document uses examples and diagrams to illustrate these concepts and components of table partitioning.
MySQL Architecture and EngineAbdul ManafMySQL uses different storage engines to store, retrieve and index data. The major storage engines are MyISAM, InnoDB, MEMORY, and ARCHIVE. MyISAM uses table-level locking and supports full-text searching but not transactions. InnoDB supports transactions, row-level locking and foreign keys but with more overhead than MyISAM. MEMORY stores data in memory for very fast access but data is lost on server restart. ARCHIVE is for read-only tables to improve performance and reduce storage requirements.
Always on in sql server 2017Gianluca HotzThis document discusses AlwaysOn availability technologies in SQL Server 2017, including Failover Cluster Instances (FCI) and Availability Groups (AG). It provides an overview of how FCI and AG work to provide high availability and disaster recovery, including capabilities like multi-subnet support. The document also summarizes new features and enhancements to FCI and AG in SQL Server 2014, 2016 and 2017.
Microsoft SQL Server internals & architectureKevin KlineFrom noted SQL Server expert and author Kevin Kline - Let’s face it. You can effectively do many IT jobs related to Microsoft SQL Server without knowing the internals of how SQL Server works. Many great developers, DBAs, and designers get their day-to-day work completed on time and with reasonable quality while never really knowing what’s happening behind the scenes. But if you want to take your skills to the next level, it’s critical to know SQL Server’s internal processes and architecture. This session will answer questions like:
- What are the various areas of memory inside of SQL Server?
- How are queries handled behind the scenes?
- What does SQL Server do with procedural code, like functions, procedures, and triggers?
- What happens during checkpoints? Lazywrites?
- How are IOs handled with regards to transaction logs and database?
- What happens when transaction logs and databases grow or shrinks?
This fast paced session will take you through many aspects of the internal operations of SQL Server and, for those topics we don’t cover, will point you to resources where you can get more information.
The Complete MariaDB Server tutorialColin CharlesPresented at Percona Live Amsterdam 2016, this is an in-depth look at MariaDB Server right up to MariaDB Server 10.1. Learn the differences. See what's already in MySQL. And so on.
Welcome To The 2016 Query Store!SolarWindsOne of our favorite new features in SQL Server 2016 is the Query Store. The Query Store houses valuable information on performance of your queries as well as gives you great insights into your query workload. This presentation will take a look at the Query Store, how it works and the type of information it holds.
High Concurrency Architecture at TIKINghia MinhThis document discusses high concurrency architectures at TIKI. It describes Pegasus, the highest throughput API, which uses caching, compression, and a non-blocking architecture to handle over 200k requests per minute with sub-2ms latency. It also describes Arcturus, the high concurrency inventory API, which uses an in-memory ring buffer, Kafka for ordering, and asynchronous database flushing to handle millions of inventory transactions per second with eventual consistency. Key techniques discussed include non-blocking designs, caching, compression, ordering queues, and asynchronous data replication.
MariaDB Galera Cluster presentationFrancisco GonçalvesThis document provides an overview and summary of various high availability (HA) solutions for MySQL databases. It begins with an introduction to HA and definitions of key terms. It then discusses MySQL replication, including asynchronous, semi-synchronous, and features in MySQL 5.6 and MariaDB 10.0. Other HA solutions covered include MHA for automated failover, Galera/MariaDB Galera Cluster for synchronous replication, shared disk solutions like DRBD, and MySQL Cluster for in-memory synchronous replication across nodes. The document provides brief descriptions of how each solution works and when it may be applicable.
SQL Server Database Backup and Restore PlanHamid J. FardIt describes how DBA needs to design and implement backup and restore plans in SQL Server based on agreed RTO and RPO.
Sql server basicsVishalJharwadeThe document provides an overview of SQL Server including:
- The architecture including system databases like master, model, msdb, and tempdb.
- Recovery models like full, bulk-logged, and simple.
- Backup and restore options including full, differential, transaction log, and file group backups.
- T-SQL system stored procedures for administration tasks.
- SQL commands and functions.
- SQL Agent jobs which are scheduled tasks consisting of steps to perform automated tasks.
Introduction to Galera ClusterCodership Oy - Creators of Galera Cluster- Galera is a MySQL clustering solution that provides true multi-master replication with synchronous replication and no single point of failure.
- It allows high availability, data integrity, and elastic scaling of databases across multiple nodes.
- Companies like Percona and MariaDB have integrated Galera to provide highly available database clusters.
Bai 11Hồng Hải Đàm QuangPháp chứng kỹ thuật số cung cấp cho sinh viên với một cách tiếp cận có hệ thống khi tiến hành một điều tra pháp chứng máy tính (cả hai loại điều tra công quyền và điều tra công ty), các yêu cầu của một phòng thí nghiệm pháp chứng máy tính bao gồm cả thiết bị phục hồi dữ liệu, phần cứng và phần mềm cần thiết để xác nhận pháp chứng kỹ thuật số trong phòng thí nghiệm.
Bài thuyết trình môn học Hệ Điều Hành.pptxduongchauskyHệ điều hành là một môn học cung cấp kiến thức cơ bản về quản lý tài nguyên của máy tính. Dưới đây là một số nội dung chính của môn học hệ điều hành:
Định nghĩa và tính chất của hệ điều hành:
Định nghĩa và tính chất cơ bản của hệ điều hành.
Lịch sử phát triển hệ điều hành.
Phân loại hệ điều hành.
Quản lý tiến trình:
Tiến trình và luồng (process/thread).
Đồng bộ hóa tiến trình.
Lập lịch CPU.
Tắc nghẽn và xử lý tắc nghẽn:
Khái niệm tắc nghẽn.
Điều kiện xảy ra tắc nghẽn.
Các phương pháp xử lý tắc nghẽn.
Quản lý bộ nhớ:
Khái niệm chung về quản lý bộ nhớ.
Các chiến lược quản lý bộ nhớ thực.
Quản lý bộ nhớ ảo.
Quản lý tập tin:
Hệ thống quản lý tập tin.
Thư mục và cách cài đặt hệ thống file và thư mục.
Quản lý nhập xuất:
Hệ thống vào ra.
Xử lý vào ra.
Quản lý truy cập đĩa.
Môn học hệ điều hành giúp bạn hiểu nguyên tắc hoạt động của hệ điều hành và cung cấp kiến thức cơ bản để xây dựng và quản lý các hệ điều hành cụ thể. Nếu bạn muốn tìm hiểu thêm, có thể xem các tài liệu chi tiết về môn học này.
Bắt đầu nghiên cứu Big DataHong OngTổ chức: TopDev.
Chủ đề: Bắt đầu nghiên cứu big data từ đâu và như thế nào.
Speaker: Ông Xuân Hồng - Data analyst @ Knorex.
Ngày: 29/07/2017.
Bài 9: Sao lưu và khôi phục hệ thống Domain - Giáo trình FPTMasterCode.vn Giám sát Active Directory
Quản trị CSDL Active Directory
Active Directory Recycle Bin
Sao lưu và khôi phục AD DS và Domain Controllers
4. Blocking
• SQL Server dùng các lock để duy trì sự toàn vẹn data cho việc đọc và ghi
• Chỉ một process có quyền kiểm soát data tại một thời điểm
• Có vài kiểu lock được dùng như Shared, Update, Exclusive, Intent …
• Blocking sinh ra khi có 2 process cùng muốn truy cập vào cùng một data
và process thứ 2 phải chờ đến khi process thứ 1 release lock
• Thông thường thì thời gian các lock được giữ là rất nhỏ
• Lock được giữ lâu hơn khi update data
• Lock cũng được dùng khi read data
5. Deadlocks
• Vấn đề phổ biến của SQL Server là deadlock
• Deadlock sinh ra khi 2 hoặc nhiều process cùng chờ một resource và
mỗi process chờ process khác hoàn thành
• Khi xảy ra deadlock và không có cách để xử lý các xung đột này, thì SQL
Server sẽ chọn một process xem là một deadlock victim và rollback
process đó, để các process khác có thể chạy tiếp
6. I/O bottlenecks
• SQL Server thường là một process hoạt động I/O cao
• SQL Server phải lấy data từ disk để đáp ứng cho các query
• Một process khác dùng nhiều I/O là database TempDB, Transaction Log
• TempDB là một khu vực làm việc tạm thời của SQL Server để làm những
việc như sort và group
• I/O là một phần quan trọng của SQL Server performance, cần chắc chắn
việc disk không bị bottleneck
• Vấn đề I/O không phải chỉ do disk, mà do cả vấn đề Index, Poor query,
Fragmentation hoặc Statistics quá hạn
7. Index
• Index là yếu tố quan trọng trong việc tối ưu query
• Các kiểu index
▫ Non-Clustered
▫ Clustered
▫ Covering
▫ Filtered
• Các việc làm dẫn đến giảm tối ưu query và database
▫ Không tạo Index
▫ Tạo quá nhiều Index trên một table
▫ Index sai column
▫ Không có kế hoạch bảo trì Index
8. Statistics
• Statistic là object chứa các thông tin thống kê về sự phân tán dữ liệu trong một hoặc nhiều column
của một table hoặc index view.
• Statistic chứa thông tin về index
• Query optimizer dùng statistic để tạo query plan giúp tăng performance của query
• Một vài trường hợp, cần tạo thêm statistic hoặc thay đổi query cho kết quả tốt nhất
• Statistic được create khi :
▫ Query optimizer tạo statistic cho các index của table hoặc view khi index được tạo
▫ Query optimizer tạo statistic cho các column đơn khi AUTO_CREATE_STATISTICS is on
• Statistic được update khi :
▫ Query optimizer xác định khi nào statistic có thể quá hạn và sau đó update chúng khi cần
▫ AUTO_UPDATE_STATISTICS is on
▫ Dùng câu lệnh UPDATE STATISTICS hoặc store procedure sp_updatestats
9. Fragmentation
• Sự phân mảnh là sự lưu trữ data không liên tục trên disk
• Internal Fragmentation
▫ Record lưu trữ không tiên tục trong page
▫ Xuất hiện các không gian không được dùng giữa các record trong page
▫ Sinh ra khi dùng các lệnh INSERT, UPDATE, DELETE
• External Fragmentation
▫ Các page được lưu trữ vật lý trong một phạm vi (Extent)
▫ Các Extent lưu trữ vật lý không liên tục trên disk
• Logical Fragmentation
▫ Các page index duy trì sự sắp xếp logic của page trong extent
▫ Do Page split mà các page bị mất trật tự
10. Wait stats
• Đưa ra thông tin về thời gian chờ việc thực thi của các thread đối với các tài
nguyên của hệ thống
• Có rất nhiều các thông số khác nhau về các loại tài nguyên của hệ thống
▫ PAGEIOLATCH_SH xảy ra khi một thead chờ đợi trên một chốt cho một bộ đệm đó
là trong một yêu cầu I/O. Yêu cầu chốt là ở chế độ Shared. Long waits có thể chỉ ra
vấn đề với disk
▫ OLEDB chờ một giao tiếp dùng OLEDB như linked server
▫ CXPACKET xảy ra với các truy vấn song song
▫ ASYNC_NETWORK_IO xảy ra khi SQL Server chờ một client lấy dữ liệu
• Dựa vào các thông số trên để điều tra nguyên nhân gây ra vấn đề về hiệu
năng của hệ thống
11. Poor query plan
• Tạo câu lệnh truy vấn dữ liệu không tối ưu
▫ Lấy ra những column không cần dùng
▫ Tính toán dữ liệu dựa trên các column trong câu lệnh JOIN và WHERE
▫ Dùng sub-query
▫ Dùng con trỏ
▫ …
▫ Index không có hoặc sai hoặc không được bảo trì
▫ Statistic không được update
▫ …
Developer
DBA
12. Tool SQLProfiler
• Bắt request vào database theo thời gian thực
• Filter các request theo khoảng thời gian thực thi của query
• Tổng hợp thông tin request trong một khoảng thời gian ra file CSV
• Thống kê Index: index đang dùng, index không dùng, cách index được
dùng query
• Thống kê Query: query dùng nhiều, query chạy chậm, query tốn tài
nguyên I/O, CPU…
• Thống kê Wait: thời gian chờ trong quá trình xử lý để đáp ứng các query
của instance SQL Server trên server (không áp dụng trên 1 database)
15. Số lần query dùng kiểu seek trên index
Seek là kiểu nhanh nhất để access data
Số lần query dùng kiểu scan trên index
Scan là khi nhiều row data phải được tìm kiếm
Số lần query từ một clusterd index hoặc heap
Số lần index được update do sự
thay đổi dữ liệu
16. Sự phân mảnh của index theo %
Reorganize index khi sự phân mảnh nằm trong
khoảng từ 5% - 30%
Rebuild index khi sự phân mảnh trên 30%
17. Đây là những index không dùng, có thể đưa
ra table của index đó cũng không được dùng
=> Xem xét xóa
18. Thời gian query plan được biên dịch
Thời gian gần nhất mà query chạy
Số lần chạy từ khi creation_time đến last_execuation_time
Nội dung câu lệnh query
19. Thống kê về thời gian chờ của các hoạt động của
cả hệ thống SQL Server, như I/O, Network,
OLEDB…
20. Thông tin index trong Execution plan
• Ctrl + M trong SSMS để bật tính năng execution plan và chạy query
Query dữ liệu trong table không có Index
Query dữ liệu trong table trên index Nonclustered
Query dữ liệu trong table trên index Clustered
Query dữ liệu trong table trên index Non-Clustered nhưng cần thêm dữ liệu từ một index Clusterd
Query dữ liệu trong table trên index Non-Clustered nhưng cần thêm dữ liệu và table ko có index Clusterd
Estimated Subtree Cost là giá trị tổng chi phí của query optimizer cho việc chạy query và tất cả
các hoạt động trước nó trên cùng subtree. Giá trị nhỏ nghĩa là nó cần ít resource
21. Tối ưu query dùng Database Engine Tuning Advisor
• Xem chi tiết tại đây.
22. Sự sai khác execution plan và thời gian thực thi trong
store procedure
• Nguyên nhân
▫ Constant value
▫ Parameter sniffing
• Cách khắc phục
▫ RECOMPILE
▫ OPTIMISE FOR UNKNOWN (từ phiên bản SQL Server 2008)
▫ Parameter masking
#5: Overview
Khi các Lock được giữ trong khoảng thời gian thì chúng sinh ra blocking, có nghĩa 1 process phải chờ cho đến khi process khác hoàn thành và release lock
Giống với deadlocking khi mà 2 process cùng chờ dùng một resource
Không giống với deadlocking vì blocking được xử lý ngay khi process release resource
Explanation
Khi dữ liệu được update thì một Update lock được dùng và khi dữ liệu được đọc thì một Shared lock được dung
Update lock sẽ tạo một Exclusive lock trên dữ liệu mà process dùng
Shared lock cho phép các process khác dùng Shared lock để truy cập dữ liệu
Khi mà 2 process cùng truy cập vào cùng một dữ liệu thì đó là khi locking và blocking xảy ra
Xem thêmhttps://www.mssqltips.com/sqlservertutorial/253/troubleshooting-blocking/
#6: Mặc định khi deadlock xảy ra, ứng dụng của bạn có thể bắt và handle error, nhưng trong SQL Server Error Log hoặc Window Event Log sẽ không bắt lỗi này
Xem thêm
https://www.mssqltips.com/sqlservertutorial/252/tracing-a-sql-server-deadlock/
#7: Overview
Hầu hết các trường hợp Database có dung lượng lớn hơn dung lượng của bộ nhớ máy tính được cài đặt và do đó SQL Server phải lấy data từ disk để đáp ứng cho các query
Do data trong database là luôn thay đổi, các thay đổi này cần ghi vào disk
TempDB cũng lưu trên disk do vậy sự phụ thuộc vào bao nhiêu object tạm được tạo trong database này có thể là hơn cả user database
I/O là một phần quan trọng của SQL Server performance, cần chắc chắn việc disk không bị bottleneck, trước đây thì việc này dễ để làm do các server có cắm disk để lưu trữ tại đó.
Xem thêm
https://www.mssqltips.com/sqlservertip/2329/how-to-identify-io-bottlenecks-in-ms-sql-server/
https://blogs.msdn.microsoft.com/sqljourney/2013/06/03/how-to-troubleshooting-sql-server-io-bottlenecks/
#8: Overview
Vấn đề phổ biến trong Index là việc thiếu index hoặc index không đúng column do đó SQL Server phải xử lý nhiều data hơn để tìm ra bản ghi phù hợp với điều kiện của câu query
Vấn đề này sinh ra 2 kiểu tìm kiếm mà trong Execution plan gọi là Index Scans và Table Scans
Việc có quá nhiều index dẫn đến SQL Server phải bảo trì tất cả các index đó, điều này có thể gây chậm database …, và các index này cũng đòi hỏi không gian lưu trữ trên disk
Explanation
Index scan hoặc Table scan là khi SQL Server phải scan data hoặc các trang index để tìm ra bản ghi phù hợp
Ngược nghĩa với scan là seek, seek dùng index để xác định các bản ghi phù hợp với query
Scan yêu cầu nhiều I/O và cũng xử lý lâu hơn
Key Lookup cũng là một kiểu tìm kiếm cần tránh, xảy ra khi data được tìm trong một non-clustered index mà các dữ liệu thêm (ngoài các cột được index trong non-clustered index) trong query cần phải lấy từ clustered index. Nếu table không có clusterd index thì một RID Lookup thay thế
Kiểm tra trắc nghiệm trong 3 phút về SQL Index: http://use-the-index-luke.com/3-minute-test
Xem thêm
https://www.mssqltips.com/sqlservertutorial/277/index-scans-and-table-scans/
https://www.mssqltips.com/sqlservertutorial/258/eliminating-bookmark-keyrid-lookups/
https://www.codeproject.com/Articles/234399/Database-performance-optimization-part-Indexing
https://www.codeproject.com/Articles/243320/Database-performance-optimization-part-Index-mai
https://www.red-gate.com/simple-talk/sql/performance/identifying-and-solving-index-scan-problems/
#10: Internal fragmentation
Những thay đổi này không phân bố đều giữa các row của table và các index, sự đầy đủ của mỗi page có thể thay đổi theo thời gian
Những không gian không dùng đến này gây ra việc sử dụng bộ nhơ kém và tốn nhiều I/O dẫn đến hiệu năng truy vấn kém
External fragmentation
Sự chuyển từ một Extent tới Extent khác gây ra sự xoay vòng disk cao hơn
Logical Fragmentation
Vì Page Split, các page bị mất sự sắp xếp.
Một page bị mất sự sắp xếp là page mà page vật lý tiếp theo được chỉ định tới một index là không phải là page được trỏ tới bởi con trỏ trang tiếp theo trong lá page hiện tại
Xem thêm
https://blog.sqlauthority.com/2010/01/12/sql-server-fragmentation-detect-fragmentation-and-eliminate-fragmentation/
#11: Là một phương pháp để điều tra sự cố về hiệu năng của hệ thống SQL Server được gọi là “waits and queues” cũng được biết đến là “wait stats”
SQL Server luôn theo dõi việc thực thi
#12: Sub-query là các query bên trong một query
Kiểu query này sẽ chạy đối với từng row của query bên ngoài trả ra, do đó làm giảm hiệu năng của truy vấn SQL
Ex:
SELECT c.Name,
c.City,
(SELECT CompanyName FROM Company WHERE ID = c.CompanyID) AS CompanyName
FROM Customer c
Dùng JOIN để thay thế
Ex:
SELECT c.Name,
c.City,
co.CompanyName
FROM Customer c LEFT JOIN Company co ON c.CompanyID = co.CompanyID
#20: SQL Server’s scheduling system works
Thread dùng CPU (RUNNING) cho đến khi nó cần phải chờ một resource.
Sau đó di chuyển tới một unordered list chứa các thread gọi là SUSPENDED.
Trong khi đó, thread tiếp theo trong FIFO queue của các thread đang chờ CPU (RUNNABLE) được CPU chạy và chuyển thành RUNNING.
Nếu thread trong SUSPENDED list được thông báo là resource của nó đã có thể dùng, thì nó chuyển thành RUNNABLE và được chuyển xuống cuối queue.
Các thread tiếp tục chạy từ RUNNING đến SUSPENDED đến RUNNABLE đến RUNNING và lặp lại cho đến khi task hoàn thành.