Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> ฐานข้อมูล

ค้นพบการปรับปรุงหลักใน SQL Server 2017

กำลังพิจารณา upgrade ไป SQL Server รุ่นใหม่กว่า? เลือกระหว่าง SQL Server 2016 หรือ 2017? คำแนะนำคือ upgrade ไป SQL Server 2017 ตามเหตุผลในโพสต์นี้

บทนำ

Microsoft SQL Server 2017 มาพร้อมฟีเจอร์ใหม่มากมาย: faster processing, more flexibility, greater cost savings SQL Server 2016 ให้ improvements มาก (big leap forward) แต่ SQL Server 2017 ให้ทั้งนั้นและมากกว่านั้นอีก Database performance ยอดเยี่ยมกับ adaptive query processing, cross-platform capabilities, statistical/data science integrations, SQL Server บน Linux, Ubuntu, Docker เทคโนโลยีมั่นคงพร้อม cost savings

ฟีเจอร์หลักใน SQL Server 2017

  • SQL Server on Linux
  • Resumable online index rebuild
  • SQL Server machine learning services
  • Query processing improvements
  • Automatic database tuning
  • TempDB file size improvements
  • Smart differential backup
  • Smart transaction log backup
  • Improved SELECT INTO statement
  • Distributed transaction support
  • New availability groups functionality
  • New dynamic management views
  • In-memory enhancements
  • Security enhancement
  • High availability and disaster recovery
  • Performance improvements

SQL Server on Linux

SQL Server ไม่ใช่แค่ Windows-based RDBMS รันบน Linux flavors ต่างๆ Develop applications ด้วย SQL Server บน Linux, Windows, Ubuntu, Docker และ deploy บน platforms เหล่านี้

Resumable Online Index Rebuild

Resume online index rebuild operation จากจุดที่หยุดหลัง events: database failovers, disk space หมด, หรือ pauses

Guidelines for Indexing

  • Clustered indexes ต้อง create, rebuild, drop offline เมื่อ underlying table มี image, ntext, text LOB data types
  • Non-unique, non-clustered indexes สร้าง online ได้เมื่อ table มี LOB types แต่ columns ไม่ได้ใช้ใน index definition (key หรือ included)
  • Indexes on local temporary tables ไม่ create/rebuild/drop online ได้ (global temporary tables ไม่มีข้อจำกัดนี้)
  • Concurrent online index DDL operations บน table/view เดียวกันได้เฉพาะ creating multiple non-clustered indices หรือ reorganizing non-clustered indices operations อื่น fail

SQL Server Machine Learning Services

SQL Server 2016 integrate R language รันภายใน database server embed ใน T-SQL script ได้ SQL Server 2017 execute Python script ภายใน database server เอง R และ Python เป็น popular languages ให้ extensive support สำหรับ data analytics และ natural language processing

Query Processing Improvements

SQL Server 2017 adapt optimization strategies ตาม application workload runtime conditions มี adaptive query processing features 3 อย่าง:

  • Batch mode memory grant feedback: Recalculate required memory สำหรับ execution plan grant จาก cache
  • Batch mode adaptive joins: ใช้ hash join หรือ nested loop join ตาม speed หลัง scan first input ของ execution plan
  • Interleaved execution: Pause optimization เมื่อเจอ multi-statement table-valued functions คำนวณ perfect cardinality แล้ว resume optimization

Automatic Database Tuning

แจ้งเตือนเมื่อตรวจพบ potential performance issue ให้ apply corrective actions หรือ ให้ database engine auto-fix performance issues จาก SQL plan choice regressions Database dynamically adapt หา indexes/plans ที่ improve workload performance และ indexes ที่ affect workloads ใช้ findings apply actions improve performance Monitor performance ต่อหลัง change ทำโดย automatic tuning action ที่ไม่ improve performance จะ auto-revert

SQL Plan Choice Regression

Database engine อาจใช้ SQL plans ต่างๆ execute T-SQL queries Plans ขึ้นกับ statistics, indexes, factors อื่นๆ บางครั้ง new plan ไม่ดีกว่า previous plan cause performance regression ควรหา previously used good plan force ใช้แทน current ด้วย sp_query_store_force_plan SQL Server 2017 ให้ข้อมูล regression plans และ recommended corrective actions เปิดใช้งาน fully automate process ให้ database engine fix plan change problems

Automatic Plan Correction

Automatic tuning features:

  • Automatic plan correction (SQL Server 2017 v14.x และ Azure SQL Database): ระบุ problematic query execution plans fix SQL plan performance problems Enable: ALTER DATABASE SCOPED CONFIGURATION SET AUTOMATIC_TUNING (FORCE_LAST_GOOD_PLAN = ON);
  • Automatic index management (Azure SQL Database only): ระบุ indexes ที่ควร add/remove

TempDB File Size Improvements

SQL Server 2017 setup ระบุ initial TempDB file size ได้ถึง 256 GB (262,144 MB) ต่อ file มี warning หาก >1GB ไม่มี instant file initialization (IFI) enabled ไม่ enable IFI อาจเพิ่ม setup time exponentially

Smart Differential Backup

Column ใหม่ modified_extent_page_count ใน sys.dm_db_file_space_usage track differential changes ต่อ database file Column ใหม่นี้ช่วย DBAs, SQL community, backup ISVs สร้าง smart backup solutions: differential backups หาก % changed pages < threshold (~70-80%) ไม่ก็ full backup ด้วย large changes differential backup cost/time ใกล้ full backup ไม่มี benefit แต่เพิ่ม restore time เพิ่ม intelligence นี้ ลด restore/recovery time

Smart Transaction Log Backup

DMF ใหม่ sys.dm_db_log_stats (database_id) expose column log_since_last_log_backup_mb ช่วยสร้าง intelligent T-log backup solutions: backup ตาม transactional activity ป้องกัน T-log size grow จาก high burst activity ป้องกัน scheduled T-log backup สร้าง files มากเกินเมื่อไม่มี activity

Improved SELECT INTO Statement

SQL Server 2017 ระบุ filegroup name สร้าง table ใหม่ด้วย ON keyword กับ SELECT INTO statement Table สร้างบน default filegroup ของ user by default ฟีเจอร์นี้ไม่มีในรุ่นก่อน

Distributed Transaction Support

SQL Server 2017 รองรับ distributed transactions สำหรับ databases ใน availability groups รวม databases บน same instance และ different instances ไม่รองรับ databases configured for database mirroring

New Availability Groups Functionality

  • Clusterless support: Availability groups setup โดยไม่ต้องมี underlying cluster (WSFC) และ across mixed environments (Windows/Linux/Docker)
  • Minimum Replica Commit setting: กำหนดจำนวน secondary replicas ต้อง commit transaction ก่อน commit บน primary

New Dynamic Management Views

  • sys.dm_db_log_stats: summary attributes และ info transaction log files monitor log health
  • sys.dm_tran_version_store_space_usage: version store usage grouped by database profile workload test environment monitor impact over time
  • sys.dm_db_log_info: VLF information monitor, alert, avert transaction log issues
  • sys.dm_d_stats_histogram: examine statistics
  • sys.dm_os_host_info: platform, distribution, service pack, language
  • sys.dm_os_sys_info: expanded CPU info (socket count, core count, cores per socket)

In-Memory Enhancements

  • Computed column และ indexes on those columns supported
  • CASE expressions, CROSS APPLY, TOP (N) WITH TIES supported ใน natively-compiled modules
  • JSON commands fully supported ใน check constraints และ natively-compiled modules
  • sp_spaceused report space สำหรับ memory-optimized tables ถูกต้อง
  • sp_rename ทำงานบน in-memory tables และ natively-compiled modules
  • Limitation 8 indexes on memory-optimized tables eliminated
  • Memory-optimized filegroup files store บน Azure storage ได้

Security Enhancement

Grant, deny, revoke permissions บน database-scoped credentials: CONTROL, ALTER, REFERENCES, TAKE OWNERSHIP, VIEW DEFINITION ADMINISTER DATABASE BULK OPERATIONS visible ใน sys.fn_builtin_permissions

High Availability and Disaster Recovery

Mission-critical uptime, fast failover, easy setup, load balancing readable secondaries ด้วย enhanced Always On ใน SQL Server 2017 Unified solution สำหรับ HA/DR บน Linux และ Windows Asynchronous replica ใน Azure VM สำหรับ hybrid HA

Performance Improvements

  • DMV ใหม่ sys.dm_exec_query_statistics_xml correlate sessions to plans (query profiling enabled)
  • Showplan XML รวม statistics used for plan, actual plans: runtime metrics, top 10 wait statistics tracked ใน query store
  • DMF ใหม่ sys.dm_db_stats_histogram access histogram programmatically โดยไม่ต้อง DBCC

สรุป

SQL Server 2017 มีการเปลี่ยนแปลงมากที่ช่วย implementation Microsoft เพิ่ม functionality ใน cumulative updates SQL Server 2017 จะได้ full support จาก Microsoft นานกว่า SQL Server 2016