Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SQL Server 2017 - Mejoras Impulsadas por la Comunidad

131 views

Published on

Con SQL Sever 2017 Microsoft incorpora nuevas funcionalidades propuestas por la comunidad de profesionales de Data Platform, hablaremos acerca de las mismas así como también sobre las funcionalidades más destacadas de la próxima versión de SQL

Published in: Technology
  • Be the first to comment

  • Be the first to like this

SQL Server 2017 - Mejoras Impulsadas por la Comunidad

  1. 1. SQL Server 2017 Mejoras impulsadas por la comunidad 14 de Junio 2017 (12 pm GMT -5) Javier Villegas Resumen: Con SQL Sever 2017 Microsoft incorpora nuevas funcionalidades propuestas por la comunidad de profesionales de Data Platform, hablaremos acerca de las mismas así como también sobre las funcionalidades más destacadas de la próxima versión de SQL Está por comenzar: Próximos Eventos Consistencia en Bases de datos Distribuidas con CosmosDB 21 de Junio Warner Chavez Moderador: SQL 2016 Basic Availability Groups multisubnet failover en Azure 28 de Junio Kenneth Ureña
  2. 2. Manténgase conectado a nosotros! Visítenos en http://globalspanish.sqlpass.org /SpanishPASSVC lnkd.in/dtYBzev /user/SpanishPASSVC /SpanishPASSVC
  3. 3. 3
  4. 4. 4 Oportunidades de Voluntariado PASS no pudiera existir sin personas apasionadas y dedicadas de todas partes del mundo que dan de su tiempo como voluntarios. Se un voluntario ahora!! Para identificar oportunidades locales visita volunteer.sqlpass.org Recuerda actualizar tu perfil en las secciones de “MyVolunteering” y MyPASS para mas detalles.
  5. 5. Sigan Participando! • Obtén tu membresía gratuita en sqlpass.org • Linked In: http://www.sqlpass.org/linkedin • Facebook: http://www.sqlpass.org/facebook • Twitter: @SQLPASS • PASS: http://www.sqlpass.org
  6. 6. SQL Server 2017 Mejoras impulsadas por la comunidad 14 de Junio de 2017 Moderador: Javier Villegas
  7. 7. Javier Villegas DBA Manager at Mediterranean Shipping Company Microsoft MVP Data Platform. Involved in the Microsoft SQL Server space since SQL Server 6.5 MCP and MCTS Blogger and MSDN Forums contributor Specialization in SQL Server Administration, Performance Tuning and High Availability Frequent speaker at SQL Saturdays and PASS Virtual Groups
  8. 8. 8 1010 0101 0010 { } T-SQL Java C/C++ C#/VB.NET PHP Node.js Python Ruby Heterogenous environments Multiple data types Different development languages On-premises, cloud, and hybrid environments
  9. 9. 9 On the platform of your choice SQL Server 2017
  10. 10. 10 What’s coming in SQL Server 2017 Supported platforms Linux Containers Windows Windows Server • RedHat Enterprise Linux (RHEL) 7.3 • SUSE Enterprise Linux (SLES) v12 SP2 • Ubuntu 16.04 & 16.10 • Possibly other Linux distributions • Docker: Windows & Linux containers • Windows Server / Windows 10
  11. 11. Agenda • Introduction • Smart Differential Backup • Smart Transaction Log Backup • SELECT INTO …. ON Filegroup • Tempdb Setup improvements • Tempdb monitoring and planning • Transaction log monitoring and diagnostics • Improved backup performance for small databases on high-end servers • Processor information in sys.dm_os_sys_info • Capturing Query Store runtime statistics in DBCC CLONEDATABASE • Resumable Online Index Rebuild • Automatic plan correction 11
  12. 12. Introduction Although SQL Server 2016 runs faster, SQL Server 2017 promises to run even faster and empower customers to run smarter with intelligent database features like: - The ability to run advanced analytics using Python in a parallelized and highly scalable way - The ability to store and analyze graph data - Adaptive query processing - Resumable Online indexing - Allow customers to deploy it on the platform of their choice (Windows or Linux) - Docker SQL Server is one of the most popular DBMS among the SQL community and is a preferred choice of RDBMS among customers and ISVs owing to its strong community support In SQL Server 2017 CTP 2.0, there are several customer delighters and community-driven enhancements based on the learnings and feedback from customers and the community from in-market releases of SQL Server. 12
  13. 13. Smart Differential Backup A new column modified_extent_page_count is introduced in sys.dm_db_file_space_usage to track differential changes in each database file of the database. The new column modified_extent_page_count will allow DBAs, the SQL community and backup ISVs to build smart backup solutions, which perform differential backup only if percentage changed pages in the database are below a threshold (say 70 to 80 percent), otherwise full database backup is performed. With a large number of changes in the database, cost and time to complete differential backup is similar to that of full database backup, so there is no real benefit to differential backup in this case; instead, it can increase database restore time. By adding this intelligence to the backup solutions, customers can now save on restore and recovery time while using differential backups. 13
  14. 14. Smart Differential Backup Consider a scenario where you previously had a backup plan to take full database backup on weekends and differential backup daily. In this case, if the database is down on Friday, you will need to restore full database backup from Sunday, differential backups from Thursday and then T-log backups of Friday. By leveraging modified_extent_page_count in your backup solution, you can now take full database backup on Sunday and let’s say by Wednesday, 90 percent of pages have changed, the backup solution takes full database backup rather than differential backup since the time and resources consumed remain the same. If database is down on Friday, you will restore the full database backup from Wednesday, small differential backup from Thursday and T-log backups from Friday to restore and recover the database much quicker compared with the previous scenario. This feature was requested by customers and community in connect item 511305. 14
  15. 15. Smart Differential Backup 15 USE <database-name> GO select CAST(ROUND((modified_extent_page_count*100.0)/allocated_extent_page_count,2) as decimal(2,2)) from sys.dm_db_file_space_usage GO select CAST(ROUND((SUM(modified_extent_page_count)*100.0)/SUM(allocated_extent_page_count),2) as decimal(2,2)) as '% Differential Changes since last backup' from sys.dm_db_file_space_usage GO
  16. 16. Smart Transaction log Backup In the upcoming release of SQL Server 2017 CTP, a new DMF sys.dm_db_log_stats(database_id) will be released, exposes a new column log_since_last_log_backup_mb. The column log_since_last_log_backup_mb will empower DBAs, the SQL community and backup ISVs to build intelligent T-log backup solutions, which take backup based on the transactional activity on the database. This intelligence in the T-log backup solution will ensure the transaction log size doesn’t grow due to a high burst of transactional activity in short time if the T-log backup frequency is too low. It will also help avoid situations where default periodic interval for transaction log backup creates too many T-log backup files even when there is no transactional activity on the server adding to the storage, file management and restore overhead. 16
  17. 17. SELECT INTO …. ON Filegroup One of the highly voted connect items and highly requested feature requests from the SQL community to support loading tables into specified filegroups while using SELECT INTO is now made available in SQL Server 2017 CTP SELECT INTO is commonly used in data warehouse (DW) scenarios for creating intermediate staging tables, and inability to specify filegroup was one of the major pain points to leverage and load tables in filegroups different from the default filegroup of the user loading the table. Starting SQL Server 2017 CTP, SELECT INTO T-SQL syntax supports loading a table into a filegroup other than a default filegroup of the user using the ON <Filegroup name> keyword in TSQL syntax shown below: 17
  18. 18. SELECT INTO …. ON Filegroup 18 ALTER DATABASE [AdventureWorksDW2016] ADD FILEGROUP FG2 select * from sys.database_files ALTER DATABASE [AdventureWorksDW2016] ADD FILE ( NAME= 'FG2_Data', FILENAME = 'S:sql_dataAdventureWorksDW2016_Data1.mdf' ) TO FILEGROUP FG2; GO SELECT * INTO [dbo].[FactResellerSalesXL] ON FG2 from [dbo].[FactResellerSales];
  19. 19. Tempdb setup improvements One of the constant pieces of feedback, the SQL community and the field after doing the SQL Server 2016 setup improvements is to uplift the maximum initial file size restriction of 1 GB for tempdb in setup. For SQL Server 2017, the setup will allow initial tempdb file size up to 256 GB (262,144 MB) per file with a warning to customers if the file size is set to a value greater than 1 GB and if “Instant File Initialization” (IFI) is not enabled. It is important to understand the implication of not enabling instant file initialization (IFI) where setup time can increase exponentially depending on the initial size of tempdb data file specified. IFI is not applicable to transaction log size, so specifying a larger value of transaction log can increase the setup time while starting up tempdb during setup irrespective of the IFI setting for the SQL Server service account. 19
  20. 20. Tempdb monitoring and planning The SQL Server Tiger team surveyed the SQL community to identify common challenges experienced by customers with tempdb. Tempdb space planning and monitoring were found to be top challenges experienced by customers with tempdb. As a first step to facilitate tempdb space planning and monitoring, a new performant DMV sys.dm_tran_version_store_space_usage is introduced in SQL Server 2017 to track version store usage per database. This new DMV will be useful in monitoring tempdb for version store usage for DBAs who can proactively plan tempdb sizing based on the version store usage requirement per database without any performance toll or overheads of running it on production servers. 20
  21. 21. Transaction log monitoring and diagnostics One of the highly voted connect items and highly requested requests from the community is to expose transaction log VLF information in DMV. T-log space issues High VLFs and log shrink issues are some of the common challenges experienced by DBAs. Some of the monitoring ISVs have asked for DMVs to expose VLF information and T-log space usage for monitoring and alerting. A new DMV sys.dm_db_log_info is introduced in SQL Server 2017 CTP 2.0 to expose the VLF information similar to DBCC LOGINFO to monitor, alert and avert potential T-log issues. In addition to sys.dm_db_log_info, a new DMF sys.dm_db_log_stats(dbid) will released in the upcoming CTP release of SQL Server 2017, which will expose aggregated transaction log information per database. 21
  22. 22. Improved backup performance for small databases on high-end servers After migrating an existing in-market release of SQL Server to high-end servers, customers may experience a slowdown in backup performance when taking backups of small to medium-size databases. This happens as we need to iterate the buffer pool to drain the ongoing I/Os. The backup time is not just the function of database size but also a function of active buffer pool size. In SQL Server 2017, we have optimized the way we drain the ongoing I/Os during backup, resulting in dramatic gains for small to medium-size databases. We have seen more than 100x improvement when taking system database backups on a 2TB machine. More extensive performance testing results on various database sizes is shared below. The performance gain reduces as the database size increases as the pages to backup and backup IO take more time compared with iterating buffer pool. This improvement will help improve the backup performance for customers hosting multiple small databases on a large high-end server with large memory. 22
  23. 23. Improved backup performance for small databases on high-end servers 23
  24. 24. Improved backup performance for small databases on high-end servers 24
  25. 25. Processor information in sys.dm_os_sys_info Another highly requested feature among customers, ISVs and the SQL community to expose processor information in sys.dm_os_sys_info is released in SQL Server 2017 CTP 2.0. The new columns will allow you to programmatically query processor information for the servers hosting SQL Server instance, which is useful in managing large deployments of SQL Server. New columns exposed in sys.dm_os_sys_info DMV are socket_count, core_count, and cores_per_socket. 25
  26. 26. Resumable Online Index Rebuild With this feature, you can resume a paused index rebuild operation from where the rebuild operation was paused rather than having to restart the operation at the beginning. In addition, this feature rebuilds indexes using only a small amount of log space. You can use the new feature in the following scenarios: • Resume an index rebuild operation after an index rebuild failure, such as after a database failover or after running out of disk space. There is no need to restart the operation from the beginning. This can save a significant amount of time when rebuilding indexes for large tables. • Pause an ongoing index rebuild operation and resume it later. For example, you may need to temporarily free up system resources to execute a high priority task or you may have a single maintenance window that is too short to complete the operation for a large index. Instead of aborting the index rebuild process, you can pause the index rebuild operation and resume it later without losing prior progress. • Rebuild large indexes without using a lot of log space and have a long-running transaction that blocks other maintenance activities. This helps log truncation and avoid out-of-log errors that are possible for long-running index rebuild operations. 26
  27. 27. Resumable Online Index Rebuild 27 ALTER INDEX IDX_2_5 ON [dbo].[A_Table02] REBUILD WITH ( RESUMABLE = ON, ONLINE = ON ); SELECT total_execution_time, percent_complete, page_count, object_id,index_id,name,sql_text,last_max_dop_used,partition_number,state, state_desc,start_time,last_pause_time,total_execution_time FROM sys.index_resumable_operations;
  28. 28. Automatic plan correction Automatic plan correction is a new automatic tuning feature in SQL Server 2017 that identifies SQL query plans that are worse than previous one, and fix performance issues by applying previous good plan instead of the regressed one. In some cases, new plan that is chosen might not be better than the previous plans. This is rare situation and might happen if an optimal plan is not included in a list of plans that will be considered as potential candidates. In other cases, SQL Server might choose the best plan for the current T-SQL query, but the selected plan might not be optimal if the same T-SQL queries is executed with different parameter values. In that case, SQL Server might reuse the plan that is compiled and cached after first execution even if the plan is not optimal for the other executions. These problems are known as plan regressions. 28
  29. 29. Automatic plan correction If you identify that previous plan had better performance, you might explicitly force SQL Server to use the plan that you identified as optimal for some specific query using sp_force_plan procedure: As a next step, you can let SQL Server 2017 to automatically correct any plan that regressed. 29 EXEC sp_force_plan @query_id = 1223, @plan_id = 1987 ALTER DATABASE current SET AUTOMATIC_TUNING ( FORCE_LAST_GOOD_PLAN = ON )
  30. 30. Automatic plan correction This statement will turn-on automatic tuning in the current database and instruct SQL Server to force last good plan if it identifies plan performance regression while the current plan is executed. SQL Server 2017 will continuously monitor and analyze plan performance, identify new plans that have worse performance than the previous ones, and force last know good plan as a corrective action. SQL Server 2017 will keep monitoring performance of the forced plan and if it does not help, query will be recompiled. At the end, SQL Server 2017 will release the forced plan because query optimizer component should find optimal plan in the future. 30 ALTER DATABASE current SET AUTOMATIC_TUNING ( FORCE_LAST_GOOD_PLAN = ON )
  31. 31. String functions A collection of new string function in SQL Server 2017 TRIM Removes the space character char(32) or other specified characters from the start or end of a string TRANSLATE Allows us to perform a one-to-one, single-character substitution in a string CONCAT_WS() Stands for Concatenate with Separator, and is a special form of CONCAT(). The first argument is the separator—separates the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments be. If the separator is NULL, the result is NULL. STRING_AGG Aggregate functions compute a single result from a set of input values. With the prior versions of SQL, string aggregation was possible using T-SQL or CLR, but there was no inbuilt function available for string aggregation, with a separator placed in between the values. 31
  32. 32. 32 DEMO
  33. 33. Other features • Graph Data Processing with SQL Server 2017 https://blogs.technet.microsoft.com/dataplatforminsider/2017/04/20/graph-data-processing-with-sql-server-2017/ • Showplan enhancements in SQL Server 2017 https://blogs.msdn.microsoft.com/sql_server_team/sql-server-2017-showplan-enhancements/ • Adaptive Query Processing https://www.youtube.com/watch?v=szTmo6rTUjM 33
  34. 34. 34 https://www.microsoft.com/en-us/sql-server/sql-server-2017
  35. 35. 35 GRACIAS @javier_vill http://sql-javier-villegas.blogspot.com.ar/ https://ar.linkedin.com/in/javiervillegas
  36. 36. Consistencia en Bases de Datos Distribuidas con CosmosDM 21 de Junio (12 pm GMT -5) Warner Chavez Resumen: Como profesionales de datos muchas veces hablamos y escuchamos hablar sobre la consistencia de los datos. Con la llegada de sistemas distribuidos NoSQL como Mongo, Cassandra y otros, ciertos términos se han popularizado como "consistencia eventual". Pero que significa esto realmente? Existen otros niveles de consistencia? Que podemos encontrar actualmente en las ofertas de nube publica? En esta sesión estudiaremos la teoría de niveles de consistencia, porque son importantes en el desarrollo de sistemas de bases de datos distribuidas y veremos como se aplican en Cosmos DB, la base de datos NoSQL de Azure. Próximo Evento

×