Skip to main content

Memory optimized OLTP database engine for SQL Server 2014 CPT2

 Memory optimized OLTP database engine for SQL Server  
 
Memory-optimized OLTP database engine (In-Memory OLTP)  support tables which reside in memory ( Memory-Optimized Tables)  and  Natively Compiled Stored Procedures ( Create Procedure code translated into native machine code and compiled into a DLL and loaded into memory )
SQL Server 2014
Advantages:  
  • Memory-Optimized Tables
·         High Performance increase: Unlike the usual Disk-based tables, all the data is stored in memory, all the time. Pages do not need to be read into cache from disk  when the memory-optimized tables are accessed.
·         For memory-optimized tables, there are no locks acquired, and thus no waiting because of blocking.
·         Concurrency improvements: When accessing memory-optimized tables, SQL Server implements an optimistic multi-version concurrency control.
·         Hash Indexes on memory-optimized tables uses Bw-tree structure and resides in memory.
  • Native stored procedures:
·         Procedure loaded into memory in native code consisting of processor instructions that can be executed directly by the CPU, without the need for further compilation or interpretation.  Syntax:
 
Eg:
  • Memory-Optimized Tables
Create table dbo.T1 (
  C1 int not null  primary key NONCLUSTERED HASH WITH (BUCKET_COUNT=2000000)
  )   with (MEMORY_OPTIMIZED=ON)

  •  Natively Compiled Stored Procedures
Create procedure dbo.p1 WITH  NATIVE_COMPIALATION, SCHEMABINDING, EXECUTE AS OWNER
AS
BEGIN ATOMIC with (TRANSACTION ISOLATION LEVEL=snapshot, LANGUAGE=N'us_english')
     Select 1
END

Comments

Popular posts from this blog

  Microsoft Power BI- Solve Problem  "Map and Filled Map Visuals aren't Enabled"   When you try to use Map or Filled Map from Visuals for the 1st time , you may get the following warning : "Map and Filled Map Visuals are disabled". This means you need to go to Options and have to enable these Visuals. Go to File ->Options and Settings-> Options -> Security-> Enable Map and Filled Map Visuals. (After this, in some cases you may need to close and reopen Power BI desktop) Now Go to Add Visual Then double click on Map or Filled Map. After that, you will be able to add Location, Legends etc. without any issues.

Difference between Clustered Index Scan and Index Scan in SQL Server

1.Clustered Index Scan ✅ What it is: A Clustered Index Scan means SQL Server is scanning every row of the entire table,  essentially performing a "table scan" because the clustered index is the table itself.  📌 When it happens: No WHERE clause or very broad filter (low selectivity). Join/filter columns aren’t indexed selectively. Query needs most or all columns (covering queries). 🧠 Performance Insight: Can be expensive for large tables. Usually appears when SQL Server can’t seek and needs to read all data. Example:    Table: CREATE TABLE dbo.Sales (     SaleID INT NOT NULL IDENTITY,     SaleDate DATE NOT NULL,     Quantity INT NOT NULL, PRIMARY KEY (SaleID) ) Query: SELECT * FROM dbo.Sales WHERE  SaleDate  BETWEEN '2025-02-04' AND '2025-02-10' 2. Index Scan (Non-Clustered) ✅ What it is: A Non-Clustered Index Scan scans all rows in a specific non-clustered index( not the full table) 📌 When it happens: The query filters on a ...

SQL Server script Error: Insufficient result space to convert uniqueidentifier value to char.

Error:    G etting below error while trying to copy data from one table to another: Msg 8170, Level 16, State 2, Line 1004  Insufficient result space to convert uniqueidentifier value to char.   Fix: UserID column which would be having Unique identifier data require more space (36 character). Size is specified as 15 here. To fix it just specify 36 as varchar length or specify Uniqueidentifier as data type for UserID  column.