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.

Planes de ejecución 3.0 sql 2016 y v next

Novedades en el generador de planes de ejecución que aparecen con SQL Server 2016 y vNext

  • Login to see the comments

  • Be the first to like this

Planes de ejecución 3.0 sql 2016 y v next

  1. 1. SOLIDQ SUMMIT MADRID 2017 #SQSummit17 Enrique Catalá | Mentor | ecatala@solidq.com | @enriquecatala Planes de Ejecución 3.0: SQL Server 2016 y 2017
  2. 2. SOLIDQ SUMMIT MADRID 2017 Agenda
  3. 3. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 • Envia datos a la CPU • Implementado por todos los operadores GetNext() • Invocaciones GetNext() fila a fila • El habitual en OLTP Row Mode • Invocaciones GetNext() por ~900 filas • Beneficios 10x-100x • Requiere columnstore Batch Mode
  4. 4. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 Compatibility Level Guarantees Query Optimizer Improvements under Trace Flag 4199 New Referential Integrity Operator Parallel Update of Sampled Statistics Sublinear Threshold for Update of Statistics Additions to the New Cardinality Estimator (New CE) Misc. Enhancements
  5. 5. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 Batch query processing in serial queries Sort operators in batch mode Window aggregates in batch mode Distinct aggregates in batch mode Parallel INSERT SELECT into heaps and CCI Heap scans for memory-optimized tables Parallel scans for memory-optimized tables Sampled and auto-update stats for memory-optimized tables String and Aggregate Pushdowns
  6. 6. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 Trace flag “mágico” para QO https://support.microsoft.com/en-us/kb/974006
  7. 7. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 NO_PERFORMANCE_SPOOL [MAX|MIN]_GRANT_PERCENT 'DISABLE_OPTIMIZED_NESTED_LOOP' 'FORCE_LEGACY_CARDINALITY_ESTIMATION' 'ENABLE_QUERY_OPTIMIZER_HOTFIXES' 'ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES' 'ENABLE_HIST_AMENDMENT_FOR_ASC_KEYS' 'ASSUME_JOIN_PREDICATE_DEPENDS_ON_FILTERS' 'FORCE_DEFAULT_CARDINALITY_ESTIMATION' 'DISABLE_PARAMETER_SNIFFING' 'DISABLE_OPTIMIZER_ROWGOAL' ENABLE_PARALLEL_PLAN_PREFERENCE
  8. 8. SOLIDQ SUMMIT MADRID 2017
  9. 9. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 Adaptative Query Processing Plan regression prevention WAITSTATS en QueryStore
  10. 10. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 Adaptative Joins • Detectar un mal operador en ejecución y cambiarlo por otro • Parameter sniffing bye bye! Interleaved execution • MultiStatementTVF con estimacion de filas ajustadas al vuelo Batch mode memory grant • Actualización de reservas de memoria para siguientes ejecuciones
  11. 11. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017
  12. 12. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 COMPATIBILITY LEVEL 140 JOIN eligible para NESTED LOOPS y HASH JOIN HASH JOIN en batch mode (columnstore) Alternativas con MERGE JOIN con el mismo outer reference
  13. 13. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 Ejecutar plan nuevo Resumir optimizacion usando cardinalidades del subarbol materializado Materializar subarbol Identificar candidatos para ejecucion entrelazada Comienzo optimización
  14. 14. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 COMPATIBILITY LEVEL 140 Solo queries (no DML) Solo para MSTVFs No usadas en CROSS APPLY
  15. 15. SOLIDQ SUMMIT MADRID 2017
  16. 16. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 AUTOMATIC_TUNING FLAG a nivel de BBDD ON-OFF DBA útil No afecta a nuestras decisiones Compatible con sp_query_store_force_plan ADMINISTRABLE Sys.dm_db_tuning_recommendations
  17. 17. SOLIDQ SUMMIT MADRID 2017SOLIDQ SUMMIT MADRID 2017 Enterprise Edition Compatibility_level = 140 Query Store Activado AUTOMATIC_TUNING (FORCE_LAST_GOOD_PLAN = ON )
  18. 18. SOLIDQ SUMMIT MADRID 2017
  19. 19. SOLIDQ SUMMIT MADRID 2017 Agenda
  20. 20. SOLIDQ SUMMIT MADRID 2017 Gracias!

×