Download ב- SQL 2014

Document related concepts
no text concepts found
Transcript
Presentation by David Yitzhak
[email protected]
‫‪‬‬
‫‪‬‬
‫‪‬‬
‫‪‬‬
‫‪ DBA‬אפליקטיבי ותשתיתי של ‪ SQL Server, Oracle ,Sybase Anywhere‬מזה ‪ 18‬שנה התמחות בשיפור ביצועים‪,‬‬
‫שרידות‪ ,‬זמינות גבוהה‪ ,‬רפלקציה (הגדולות בעולם ) ‪ ,‬תוספים גיאוגרפיים‪ ,‬אבטחת מידע ‪Business Intelligence ,‬‬
‫‪ Data Mining,‬ואלגוריתמיקה (‪ Oracle R‬ומטלב) ‪.‬‬
‫עובד עם עיבוד מקבילי' אלגוריתמים ( ‪ )Microsoft HPC‬ופתרונות ‪.NoSQL‬‬
‫מרכז את פורום ‪ DBA‬צפון של ‪ ilOUG‬עם הרצאות רבות על נושאים מתקדמים ‪.‬‬
‫‪http://www.iloug.org.il/DBA_NorthForum.php‬‬
‫‪‬‬
‫כותב ראשי ב‪ .ildba.co.il -‬עשרות מאמרים על ‪ Oracle‬ו‪. SQL Server -‬‬
‫‪‬‬
‫‪ 2‬הרצאות בפורום משתמשי ‪. SQL Server‬הרצאה אחרונה על בפורום משתמשי ‪ BI‬על ‪.SQL 2014 Data Mining‬‬
‫‪‬‬
‫ב‪ 2010-‬הרצאה ב‪ Oracle Open world-‬על שילוב מתקדם של ‪ Data Guard‬ו‪.ODP.NET -‬‬
‫‪‬‬
‫‪‬‬
‫הכתבות שלי מתפרסמות בפורומים מקומיים‪ :‬עיבוד מקבילי עתיר ביצועים ( ‪ )Microsoft HPC‬בשילוב ‪ Oracle),‬ו‪SQL -‬‬
‫‪ , )SERVER‬הנדסת מערכת של תשתיות מחשוב (פרויקט זוכה פרס גון) ‪ ,‬ובעיתונות העולמית ( ‪SQL Server‬‬
‫‪.)magazine‬‬
‫‪ 3‬תארים מהטכניון‪BSC :‬בהנדסת מערכות מידע ושני תארים שניים ‪MBA :‬ו‪( ME -‬הנדסת מערכת)‪.‬‬
‫ רקע‬HYBRID Transactional Analytical Processing – HTAP ‫ ו‬HPC
‫ ושיפור ביצועים‬Delayed Durability
benchmark -‫ ה‬.SQL 2014 -‫) ב‬CCI( Clustered ColumnStore Index
. ‫האולטימטיבי‬
‫ בסביבה וירטואלית‬in Memory OLTP -‫שימוש ב‬
Memory Optimized Tables -‫פתרונות זמינות גבוהה ותמיכתם ב‬
Entity Framework ‫ בכלל ושילוב מול‬Memory Optimized Tables ‫פיתוח מול‬
demo –SQL 2014 -‫ ב‬Hash Index -‫ ו‬Memory Optimized (MO) table ‫כוונון של‬
Demo -In-Memory OLTP Transaction isolation levels
Demo – ‫ אופרטור‬Index seek -‫ ו‬Composite hash indexes
...... ‫ נחמד אבל‬- SSD Buffer Pool Extension










: ‫לא יכוסה בהרצאה בגלל קוצר זמן למרות שהבטחתי‬
Active Active cluster ‫ לעומת‬High Availability Group 
????? ‫ – האומנם יש שיפור‬SQL 2014 ‫ ב‬Cardinality Estimator 
• HPC gives engineers the computation resources they
need to speed research and development.
 Examples:
◦ Test simulations
◦ Modeling solutions
◦ Highly complex problems

Computes nodes
◦ Dozens nodes oh HPC, Win 2008\2012R2.
◦ In future : Several thousands on Win 7 works stations
◦ Run Matlab and .Net APP process VS Oracle DB
12C/SQL 2014 .
◦ .Net APP use Oracle Data Access Components
(ODAC)

No of Processes running VS SQL Server
◦ Job can assigned per CPU Core .
◦ 12 cores per compute Nodes.
◦ Assume we have N Compute Nodes
◦ In Full utilization
 Job per core
 N X 12 =1200 processes of .NET APP vs DB .


MATLAB
Mechanical CAD :
◦ ABAQUS
◦ CST (Computer Simulation
Technology)

Monte Carlo Simulation
The Heat Map view
gives instant
feedback on the
health of the
cluster-upwards of
1,000 nodes,
without scrolling.
Workstation
NAS
SAN
Oracle /SQL
Data file on HDS
storage
…
Oracle (~10T Data)
12CR1 ,64 bit/
SQL 2014
…
4. Job finished ,response
return to client
3. Compute
Nodes run vs
SQL Sever
In memory OLTP
Application network
2. Assigns nodes
for client job
…
Head
node
Failover
Head
node
Private network
Enterprise network
1. User submits
job.
Dozens Compute nodes:
, .Net ,Matlab for simulation data mining
the results and real time analytics
Win 2008/12 R2
Log file on shared Drives using
CIFS Protocol to SATA disks .
Identify simulation
Objective
Monitor
Performance & recalibrate
Understand
Simulation data
Deploy Model
Prepare data on HPC
Test Models
Develop models to
explore / analyze
and predict data
• Use Matalab , .Net
App
• Good starting points
MSSQL data mining
10

The in-memory transaction log is flushed to
disk when:
◦ A fully durable transaction in the same database makes a
change in the database and successfully commits
◦ Executes sp_flush_log successfully
◦ The in-memory transaction log buffer fills up and
automatically flushes to disk
ALTER DATABASE … SET DELAYED_DURABILITY = { DISABLED | ALLOWED | FORCED }
DELAYED_DURABILITY = { OFF | ON } (with NATIVE_COMPILED sprocs ONLY
COMMIT [ { TRAN | TRANSACTION } ] [ transaction_name | @tran_name_variable ] ]
[ WITH ( DELAYED_DURABILITY = { OFF | ON } ) ]


start performance monitor
Add the Log Flushes/sec counter of the SQL
Server:Database object to the live running
performance monitor.

As you can see, This is not a busy database
Delayed Durability has forced and there are
currently no log flushes happening



In order to ensure that the transaction and its data
changes are hardened to the log and thus durable,
run sp_flush_Log
You can view the log flush in Performance Monitor
The spike in the counter indicates the log flush.


sets the Delayed Durability setting to Disabled
This ensures all transactions will be durable in
the AdventureWorks2014 database.

The transaction flushed to the log and is
thus durable at the time of the commit




SQL Express+ Feature
Transaction commits :fully durable or delayed
durable
Delayed transaction durability reduces the latency
due to log I/O by keeping the transaction log
records in memory and writing to the transaction
log in batches, thus requiring fewer I/O operations
Delayed Durability could be an option
◦ Accept some data loss in the event of a system crash or
restart
◦ Performance of the system is more important..
◦ Bottleneck on transaction log writes.
◦ A high contention workload: Remove the contention as it
reduces the commit time and locks will be released faster.
‫‪‬‬
‫האינדקס יכול להיות על חלק מהעמודות‪.‬‬
‫‪‬‬
‫נבנה על גבי אחסון מסוג שורה (‪ )rowstore‬ולא אחסון מסוג עמודה (‪.)column store‬‬
‫‪‬‬
‫‪‬‬
‫‪‬‬
‫‪‬‬
‫טבלה עם ‪ NCCI‬היא לקריאה בלבד ‪ .‬במקרה של עדכון נדרש לבצע ‪ Drop‬לאינדקס ‪ ,‬טעינת נתונים‬
‫ויצירת אינדקס ‪ .‬לחילופין ‪ , DISABLE...ALTER INDEX‬טעינת נתונים ובסיום ‪ALTER INDEX...‬‬
‫‪.ENABLE‬‬
‫אלגוריתם הדחיסה הוא של ‪ B tree‬או ‪ Heap‬ולא יכול לנצל את היתרונות של אחסון מבוסס עמודה ‪.‬‬
‫ניתן ליצור ‪ NCCI‬אחד בלבד על טבלה ‪.‬‬
‫שאילתות מסוג שוויון (‪ )equality‬ושאילתות על טווח קצר (‪ )rang queries‬יעילות יותר כי הם‬
‫משתמשים ב‪. B tree -‬‬
‫‪http://www.ildba.co.il/non-clustered-columnstore-indexes-sql-2012-2014/‬‬
‫‪‬‬
: ‫המאמרים שלי‬
Clustered ColumnStore Index ‫ עבודה עם‬
Clustered ColumnStore Index ‫בדיקת ביצועים של‬

‫ – אשליה‬updateable Clustered ColumnStore Index
?‫או אמת‬

‫ מגבלות והערות נוספות‬lustered ColumnStore Index

‫‪‬‬
‫ב – ‪ CCI‬המידע מאוחסן בצורה דחוסה וע"פ חלוקה לעמודות בצורה כזו שניתן לבצע דחיסה בצורה יעילה ‪ ,‬לחסוך‬
‫מקום במערכת האחסון ולשפר ביצועים ע"י צריכת זיכרון נמוכה ‪ ,‬כי רק העמודות הנדרשות מגיעות לזיכרון ובצורה‬
‫דחוסה ‪CCI .‬לא מאוחסן בצורה ממוינת כמו ‪ Clustered Index‬רגיל‪ ,‬למרות שמונח ‪ Clustered‬מופיע בשם‬
‫האינדקס‪.‬‬
‫‪‬‬
‫כל העמודות נדרשות עבור ‪ . CCI‬לא ניתן ליצור אינדקסים נוספים ‪.‬‬
‫‪‬‬
‫טבלה עם ‪ CCI‬ניתנות לעדכון ‪ INSERT, UPDATE, DELETE :‬ו‪.bulk load -‬‬
‫‪‬‬
‫‪‬‬
‫‪‬‬
‫‪‬‬
‫ניתן לבצע שימוש ב ‪ Archival Compression‬שמשפר את יחס הדחיסה עד ‪. X10‬זהו אלגוריתם דחיסה משופר‬
‫החל מ – ‪ . SQL 2014‬בפקודה ‪ ALTER INDEX … REBUILD‬התווספה האופציה‬
‫‪ Archival Compression . COLUMNSTORE_ARCHIVE‬מיועד עבור כמויות מידע גדולות למטרות ארכיון‪,‬‬
‫כאשר נדרש מצמום בשטח דיסק כשהתקורה הנוספת היא בזמן נוסף לצורך אחסון ואחזור לעומת אלגוריתם‬
‫הדחיסה הרגיל של ‪.CCI‬‬
‫שאילתות מסוג שוויון (‪ )equality‬ושאילתות על טווח קצר (‪ )rang queries‬פחות יעילות ויתכן וידרשו סריקה‬
‫מלאה של הטבלה ‪.‬‬
‫ב‪ SQL 2012 Data types -‬רבים לא נתמכו ע"י ‪ NCI‬כמו ‪ unique identifier ,binary‬ו‪ decimals -‬עם‬
‫‪ . precision > 18‬ב‪ SQL 2014 -‬כל ה‪ Data types -‬שהם לא מסוג ‪ blob‬נתמכים ע"י ‪columnstore‬‬
‫‪ index‬מלבד ‪geography , hierarchyid ,sql_variant , timestamp, rowversion , image , )n)text :‬‬
‫‪ xml , geometry ,‬ו‪.)n(Varchar(max) -‬‬
‫‪ CCI‬זמין בגרסאות ‪ Enterprise, Developer‬ו‪ Evaluation Edition -‬בלבד כלומר יש לו משמעות כספית‬
‫מבחינת רישוי‪.‬‬
‫‪ ‬כל העמודות חיבות להיות מוכלות ב ‪ CCI‬ובעת היצירה אין‬
‫צורך לציין את העמודות ‪ .‬אם ננסה לעשות זאת ‪:‬‬
‫‪‬‬
‫בקטע הקוד הבא ניצור טבלה בשם ‪ , SalesOrders‬ניצור עליה ‪ CCI‬ונבצע הכנסה של ‪2400000‬‬
‫שורות ‪.‬‬
.include actual execution plan -‫ ל‬turn on ‫ נבצע‬
‫נריץ את השאילתה הבאה‬
columnstore -‫ ניתן לראות שיש שימוש בשאילתה ב‬
: execution plan -‫ ב‬index scan
‫‪‬‬
‫‪ sys.column_store_row_groups‬הוא ‪DMV‬שמאפשר לראות את כל‬
‫ה‪ Row Groups -‬שב‪ Delta Store -‬וב‪. Column Stores -‬‬
‫‪‬‬
‫לכל ‪ partition‬בטבלה יש ‪ Delta Store‬אחד לפחות ‪.‬‬
‫‪‬‬
‫נשתמש ב ‪ DMV‬זה בשביל להחליט מה מספר ה‪. Delta stores -‬‬
‫‪‬‬
‫אנו משתמשים ב‪ DMV -‬זה בשביל לבדוק את איכות ה ‪ . CCI‬אם יש ‪Row‬‬
‫‪ Group‬עם פחות ‪ 1M‬שורות ‪ ,‬יש לבדוק למה‪ ,‬כפי שאדגים להלן ‪.‬‬
‫‪‬‬
‫‪‬‬
‫‪‬‬
‫הסבר ‪ :‬יש לנו ‪ Row Group 2‬שהם דחוסים ( ‪state=3‬‬
‫‪ ),state_description=COMPRESSED‬ו ‪ Delta Dtore‬אחד ( ‪state=1 ,‬‬
‫‪. )state_description=OPEN‬‬
‫שימו לב שסכום העמודה ‪ row_count‬שווה ל ‪1048576+1048576+2848‬‬
‫סה"כ ‪ , 2,400,000‬שזה בדיוק מספר השורות שהכנסנו ‪.‬‬
‫ההסבר ‪ .‬כמו שצינתי מספר השורות המינימאלי עבורו יתבצע דחיסה ומעבר לפורמט‬
‫של ‪ Column Store‬הוא ‪.1048076‬‬
‫‪ ‬אני כעת אעורר את תהליך ה‪ , tuple mover -‬באופן א‪-‬‬
‫סינכרוני ‪ ,‬ע"י שימוש בפקודה הבאה כדי לאלץ דחיסה של‬
‫כל ה‪ Row group -‬לפורמט של ‪. Column Store‬‬
‫‪‬‬
‫‪‬‬
‫‪‬‬
‫‪ sys.column_store_segments‬מאפשרים למצוא את טווח הערכים של העמודות עבור הדחיסה שמשתמש‬
‫באלימינציה של סגמנטים ומידע על גודלו של כל ‪ segement‬ו ‪.sys.column_store_segments‬‬
‫ל ‪ columnstore‬יש ‪ row groups 2‬ואין אף ‪delta store‬או ‪. delete bitmap‬‬
‫ניתן לראות את טווח הערכים עבור כל ‪row groups‬בעמודות ‪min_data_id‬ו ‪ max_data_id‬למשל עבור‬
‫העמודה עם ‪column_id=1‬‬
‫‪ ‬בניה מחדש של האינדקס יכולה להתבצע ע"י האופציה‬
‫)‪ , WITH (DROP_EXISTING = ON‬שזורקת את‬
‫האינדקס הקיים ובונה אותו מחדש ‪ .‬שימו לב שאם האינדקס‬
‫לא קיים תתקבל הודעת שגיאה ‪.‬‬
‫‪‬‬
‫ב‪ SQL 2014 -‬ל ‪ CCI‬יש אלגוריתם דחיסה נוסף ‪ ,‬מלבד האלגוריתם שמגיע כבררת‬
‫מחדל ‪ ,‬בשם ‪ . Column Store Archiving‬המחיר תקורה של ‪ CPU‬גבוהה יותר וזמן‬
‫גישה איטי יותר ‪ .‬הדחיסה כאמור יכולה להיעשות פר ‪ partition‬בטבלה ‪ .‬נוכל לבדוק מה‬
‫גודל הטבלה שבנינו ע"י הפרוצדורה ‪ sp_spaceused‬באופן הבא ‪:‬‬
. SalesOrderNumber ‫ על השדה‬cluster index ‫ עם‬- SalesOrders_Clustered
. SalesOrderNumber ‫ על השדה‬NCI ‫ עם‬- SalesOrders_NCCI
‫ נכניס לכל אחת‬. ‫ שכמו שראינו מכיל את כל העמודות‬, CCI ‫– עם‬SalesOrders_CCI
‫ מיליון רשומות‬12 ‫מהטבלאות‬



. SalesOrderNumber ‫ על השדה‬NCI ‫ עם‬- SalesOrders_NCCI

‫‪‬‬
‫‪ –SalesOrders_CCI‬עם ‪ , CCI‬שכמו שראינו מכיל את כל העמודות ‪ .‬נכניס לכל אחת‬
‫מהטבלאות ‪ 12‬מיליון רשומות‬
‫‪‬‬
‫נריץ את קטע הקוד הבא שמבצע את אותה שאילתה עבור ‪ 3‬הטבלאות הנ"ל כ‪ batch -‬אחד‬
‫‪ .‬יש לבחור באופציה ‪ Include Actual Execution Plan‬ב‪SQL server -‬‬
‫‪ Management studio‬תחת התפריט ‪.Query‬‬
‫‪‬‬
‫התוצאה עבור כל טבלה אפשר לראות להלן ‪ .‬תחת ה‪ tab -‬בשם ‪ execution plan‬נוכל‬
‫לראות את המחיר היחסי באחוזי של כל שאילתה ‪.‬‬
‫‪‬‬
‫תחת ‪ message Tab‬נוכל לראות כמה ‪ logical read‬עבור כל שאילתה ‪ .‬נסכם את‬
‫התוצאות ‪:‬‬
‫‪‬‬
‫ל ‪ columnstore index‬יש ‪ 2‬סוגי אופרטורים ‪ batch mode :‬ו‪ Batch mode . row mode -‬הוצג יחד ‪columnstore‬‬
‫‪ index‬ב‪ . SQL 2012 -‬מכיוון ש ‪ columnstore index‬הוא מבוסס עמודות ‪ ,‬ע"י שימוש ב‪ batch mode -‬נוכל לעבד‬
‫שורות רבות במקביל ב‪ batch -‬אחד ובצורה יעילה יותר‪ .‬ל‪ batch mode -‬היתרונות הבאים ‪:‬‬
‫‪‬‬
‫מעבד בין ‪ 64‬עד ‪ 960‬שורות בו זמנית ולכן מאפשר משיכת מידע בכמות גדולה יותר ‪ ,‬ללא צורך בביצוע של‬
‫‪. decompression‬‬
‫‪‬‬
‫מספר קריאות מערכת קטן יותר ‪.‬‬
‫‪‬‬
‫זמין רק ב‪ parallel plan -‬ב‪.columsstore -‬‬
‫‪‬‬
‫אין העתקה מיותרת של מידע ‪.‬‬
‫‪‬‬
‫בשביל לראות אם ‪ columnstore‬רץ ב‪ batch mode -‬או ‪ , row mode‬עליך לבדוק את ה‪ properties -‬של‬
‫‪ columnstore operation‬ב‪ execution plan -‬עבור הטבלה‬
‫‪.. SalesOrders_CCI‬‬
‫‪ ‬החל מ‪ SQL 2008 -‬עמודות עם הרבה ערכים של ‪ , Null‬יכולה‬
‫להיות מאוחסנת כ – ‪ , Sparse Column‬ע"י ציון התכונה ‪SPARSE‬‬
‫לעמודות שהם ‪ , nullable‬בכדי לחסוך את התקורה של אחסון‬
‫העמודות עם ערכי ‪ . NULL‬אי אפשר ליצור ‪columnstore index‬‬
‫על עמודה מסוג ‪: Sparse‬‬

https://msdn.microsoft.com/enus/library/%20dn529286(v=sql.120).aspx
Without MO tables, 2 best practices:

With MO tables

◦ MIN_SERVER_MEMORY- Assign only the amount of memory that is
required so sufficient memory remains for other processes
(thereby avoiding paging).
◦ Do not set the memory pre-allocation value too high. Other
processes may not get sufficient memory at the time when they
require it ->memory paging
 If you follow this advice you can run into an issue An attempt to restore
and recover a database could result in the database being in a “Recovery
Pending” state, even if you have sufficient memory to recover the
database .
 When your SQL Server gets rebooted or the service restarted. It is
possible for the database to get held in a recovery-pending state.
 Can impact the VM being able to use HA features that the Hypervisor (
live migration)
 Why? SQL Server loads the data into RAM more quickly than the
hypervisor's dynamic memory allocation provides memory to the
database.



Set a memory reservation
for the virtual machine on
the hypervisor- ensuring
that enough memory is
allocated at startup
pre-allocate sufficient
memory to the database
(MIN_SERVER_MEMORY) to
recover or restart the
database, not a Min value
relying on dynamic memory
to provide the additional
memory when needed.
Error Message insufficient
system memory
◦
◦
Msg 701, Level 17, State 103,
Line 32
There is insufficient system
memory in resource pool
'Pool_AdventureWorks2014'
to run this query.





High-Availability Technology Support for memory-optimized tables
◦ Fully supported : AlwaysOn Failover Cluster , Availability Groups, and
LogShipping.
FCI Failover
◦ Data from durable memory-optimized tables must be loaded Increase
failover time.
AlwaysOn Availability Groups
◦ Only durable memory-optimized tables are replicated to secondary nodes.
◦ Can access and query those tables on the readable secondary nodes.
◦ Data from non-durable memory-optimized tables is not replicated and will
be lost in the case of a failover.
Replication
◦ Can set up transactional replication on databases with memory-optimized
tables;
◦ Those tables cannot be used as articles in publications.
Mirror
◦ Not supported.
◦ In-memory OLTP is an Enterprise Edition feature; replace database
mirroring with AlwaysOn Availability Groups.
‫‪‬‬
‫פיתוח מול ‪ MO Tables‬לא שקוף למשתמש ‪ ,‬דורש שינוי בקוד ‪ .‬גרסה שתומכת‬
‫ב‪ Mo Table -‬וגרסה שלא תומכת ‪.‬דוגמא בהמשך ‪.‬‬
‫‪ ‬לכן הוא בעיתי לספקי תוכנה בהיקף נרחב כי הוא דורש תקורה נוספת תחזוקת‬
‫קוד ‪.‬‬
‫‪‬‬
‫‪‬‬
‫דורש חומרה חזקה ‪ ,‬עם הרבה זיכרון ‪ .‬אופציה מדהימה של ‪Enterprise‬‬
‫‪ Edition‬ולכן יש לו משמעות כספית מבחינת רישוי ‪.‬‬
‫אם אתה משתמש ‪ Enterprise Edition‬תוכל להשתמש ב‪MO table -‬‬
‫‪ variables‬או ‪ non-durable MO table variables‬במקום ‪on-disk‬‬
‫‪. temporary tables‬‬
‫‪ ‬שיפור ביצועים של החישובים ותהליכי ‪ ETL‬ב‪ , DW -‬ב ‪HYBRID‬‬
‫‪ Transactional Analytical Processing – HTAP‬ובסביבת הסימולציה ‪.‬‬
‫‪‬‬
‫אפשרות נוספת להשתמש ב ‪ session state storage‬לאפלקציות ‪ASP.Net‬‬
‫או ‪ distributed cache‬לאפליקציות ‪ client‬במקום פתרונות צד שלישי יקרים ‪.‬‬
‫‪‬‬
‫תמיד לזכור שאורך השורה המכסימלי הוא ‪. 8060 byte‬‬
Model based ‫ מסוג‬Entity Data Model (EDM) ‫נניח שבנינו פרויקט‬

Setting the connection for an
EDM
Selecting database objects to
be imported into an EDM.
‫ בסיס הנתונים יצטרך‬. LINQ to Entities Query (Direct SQL) ‫אנו משתמשים ב‬
IM OLTP ‫להיות משוכתב פעמיים עם ובלי תמיכה‬
The entity data model design
surface in Visual Studio.
Importing a function into the
conceptual model.

DEMO
DEMO



IM OLTP Transaction supports 3 :
◦ SNAPSHOT
◦ REPEATABLE READ
◦ SERIALIZABLE.
Disk tables : Block or being blocked by
sessions
IM OLTP uses a completely different
approach to enforce data consistency .
◦ IM OLTP validates data consistency at the
transaction COMMIT time
◦ Throws an exception and rolling back the
transaction if rules were violated.


SERIALIZABLE isolation level prevents the
session from committing a transaction when
another session inserted a new row and
violated the serializable validation.
MO tables
◦ Other sessions able to modify data that was read by
the active serializable/REPEATABLE READ
transaction.
◦ Transaction aborts at the time of COMMIT.

On-disk tables
◦ SERIALIZABLE transaction would successfully commit
blocking other sessions until it is done.




Works in a similar manner to on-disk
tables
Protects from Non-Repeatable Reads and
Phantom Reads.
It reduces the load on SQL Server- it does not
need to perform repeatable read and serializabl
Validations at the commit stage.



Write/write conflicts work the same way
regardless of the transaction isolation level in IM
OLTP.
SQL Server does not allow a transaction to modify
rows that have been modified by other
uncommitted transactions.
In the example we use the SNAPSHOT isolation
level, however the behavior does not change with
different isolation level.
DEMO


Efficient only in the case of an equality search
Our example : index on (LastName, FirstName)
columns
◦ Composite hash indexes





SQL Server calculates the hash value for the
combined value of all key columns.
A hash value calculated on a subset of the key
columns would be different
MO table requires queries to have equality
predicates on both LastName and FirstName
Different from indexes on on-disk tables:
◦ Index can be used for a Seek operation regardless of
whether the predicate on the FirstName column is specified
in the where clause of a query.
‫‪‬‬
‫‪ Buffer Poll extension‬ב‪ SQL 2014 -‬מאפשר הרחבה של ה‪buffer -‬‬
‫‪ Pool‬ל ‪ . non-volatile storage‬כלומר לדיסק או מערך דיסקים מסוג ‪. SSD‬‬
‫‪ ‬רק דפים נקיים נרשמים ל‪ BPE -‬בשביל למנוע איבוד מידע אפשרי ‪.‬‬
‫‪ ‬שיפור ביצועים הוא עבור סביבת ‪ OLTP‬עם קריאות מסיביות ‪.‬‬
‫‪‬‬
‫יתרונות ‪:‬‬
‫‪ ‬זמין בגרסת ‪ ( SQL 2014 standard Edition‬לא מצריך רישוי גרסת ‪)Enterprise‬‬
‫‪ ‬טוב עבור עומסי קריאה אינטנסיביים בסביבת ‪. OLTP‬‬
‫‪ Throughput ‬גבוה אם משתמשים בדיסק ‪.SSD‬‬
‫‪ ‬סינטקס הוא פשוט ולא דורש שינוי בקוד ‪.‬‬
‫‪‬‬
‫מגבלות‪:‬‬
‫‪ ‬לא עבור מחסני נתונים ועומסי כתיבה אינטנסיביים ‪.‬‬
‫‪ ‬בארגונים גדולים שעובדים מול חוות אחסון בעיתי ‪ ,‬כי הכנסת דיסק ‪ SSD‬למערך כזה או למשל‬
‫מחשבי ‪ blade‬הוא בעייתי ‪.‬‬

David Itshak
◦ [email protected]


Ildba.co.il
www.iloug.co.il