In Memory Tables Flashcards
13 Syntax Limits of Natively Complied Stores Procedures
- Cannot Access Tempdb
- Cannot use Cursors
- Cannot use CASE statement
- Cannot use MERGE statement
- Cannot use SELECT INTO clause
- Cannot use PERCENT or WITH TIES in TOP clause
- Cannot use DISTINCT with Aggregates
- Cannot use the following operators: INTERSECT, EXCEPT, APPLY, PIVOT, UNPIVOT, LIKE, CONTAINS
- Cannot use Common Table Expressions
- Cannot use multi row insert statements
- Cannot use EXECUTE WITH RECOMPILE
- Cannot use Views
- Cannot use FROM Clause in update statement
What system stores procedure do you use to enable collection of stored procedure level stats on natively compiled stored procedures?
Sys.sp_xtp_control_proc_exec_stats
What system stored procedure do you use to enable the collection of query level stats on natively compiled stored procedures?
Sys.sp_xtp_control_query_exec_stats
How would you explicitly tell SQL to make data durable for an in memory table?
Use the DURABILITY = SCHEMA_AND_DATA
For instance:
WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA
What are the durability options to make in memory tables more performant?
- Set the durability option on the table creation
Example DURABLITY = SCHEMA_ONLY
- Set the delayed durability option at the database level
Example ALTER DATABASE WorldWideTraders SET DELAYED_DURABILITY = ALLOWED
- Set the delayed durability at the transaction level
COMMIT TRANSACTION WITH (DELAYED_DURABLITY = ON)
What are good cases for natively compiled stored procedures?
- Applications needing the best possible performance
- Queries that execute frequently
- Aggregation
- Nested Koop joins
- Multi statement select, insert, update or delete operations
- Complex expressions
Procedural logic such as conditions and loops
Use Cases for In Memory Tables
- High data ingestion rates
- High Volume, high performance data reads
- Complex business logic in stored procedures
- Real time data access
- Session state management
- Applications relying heavily on temporary tables, table variables and table valued parameters
- ETL operations