View stunning SlideShares in full-screen with the new iOS app!Introducing SlideShare for AndroidExplore all your favorite topics in the SlideShare appGet the SlideShare app to Save for Later — even offline
View stunning SlideShares in full-screen with the new Android app!View stunning SlideShares in full-screen with the new iOS app!
מטרות היכרות עם תהליך P&T כלים חדשים ולא מוכרים לניהול Performance הבנת יישום נכון של Compression היכרות עם יכולות Scale out בגירסאות הנוכחיות וב-Denali
מי אני? מאיר דודאי: SQL Server MVP יועץ בתחום בסיסי נתונים ניסיון של למעלה מ-10 שנים ב-SQL Server עורך האתר:
ואלינור החברה המובילה בישראל במתן שירותים מקצועיים בתחום בסיסי נתונים: SQL Server, Oracle, MySQL צוות יועצים מוביל המתמחה בכלל הרבדים שלבסיסי הנתונים שותפים של Microsoft ו- Oracle נציגי מוצרים מובילים בתחום ה-DB מעל 300 לקוחות בכל המגזרים
My Assumptions About You You may be a part-time or full-time DBA You are familiar with SQL Server in previous versions You would like to learn about new features in SQL Server 2008&R2&2011 that can help you to manage and improve performance You are interested in good lunch, two days free from work, and some giveaways from advertisers
GreenRoad Case Study:RCSI GreenRoad is an Israeli startup improving driving behavior for fleets and consumers Works as SAAS More than 400 inserts/sec Users running queries and reports frequently Method used to increase concurrency: RCSI: Read Committed Snapshot Isolation
Read Committed Snapshot New “flavor” of read committed Turn ON/OFF on a database Readers see committed values as of beginning of statement Writers do not block Readers Readers do not block Writers Writers do block writers Can greatly reduce locking / deadlocking without changing applications
Lock Escalation HOBT T1: IX T1: X Page Page Page T1: X T1: X T1: X T1: X T1: X Row Row Row T1: X T1: X T1: X Lock Escalation T1: IX
Lock Escalation Converting finer-grain locks to coarse grain locks. Row to Table Page to Table. Benefits Reduced locking overhead Reduces Memory requirement Triggered when Number of locks acquired on a rowset > 5000 Memory pressure
Partitioned Tables and Indexes SQL Server 2005 introduced partitioning, which some customers use to scale a query workload Another common use is to streamline maintenance and enable fast range inserts and removals from tables Partitioned Table FG1 FG2 FG3 Partition 2 Partition 3 Partition 1
Lock Escalation: The Problem Lock escalation on partitioned tables reduces concurrency as the table lock locks ALL partitions Only way to solve this in SQL Server 2005 is to disable lock escalation Query 1 Query 2 Partitioned Table IX X ESCALATE update update Partition 2 Partition 1 Partition 3 FG1 FG2 FG3
Lock Escalation: The Solution SQL Server 2008 allows lock escalation to the partition level, allowing concurrent access to other partitions Escalation to partition level does not block queries on other partitions Query 1 Query 2 Partitioned Table IX ESCALATE update update X Partition 2 Partition 1 Partition 3 FG1 FG2 FG3
Filtered Indexes An index with a WHERE clause to specify a criteria Essentially index only a subset of a the table Query optimizer most likely to use when WHERE clause matches that of the filtered index
Using Filtered Indexes Advantages of Filtered Indexes Improve query performance, partly by enhancing execution plan quality Smaller index maintenance costs Less disk storage
Using Filtered Indexes Scenarios for Filtered Indexes Sparse columns, where most data is null Columns with categories of values Columns with distinct ranges of values
New server option in SQL Server 2008 Only a stub is cached on first execution Full plan cached after second execution SP_CONFIGURE 'show advanced options',1RECONFIGUREGO SP_CONFIGURE 'optimize for ad hoc workloads',1RECONFIGUREGO Optimize for ad hoc workloads
“I would not use it on some DWH systems” “Why is this not on by default?” “I can’t think of a reason why opt for adhoc workloads would ever really be a problem” “I definitely recommend it!” “Best movie of 2011! Breathtaking!” “But paintball guns are also not very pleasant!” How good is it?
Codename Lyngby Case Study: Power of bulk inserts Security/audit system 50GB of data inserted daily Data is kept for one year and should be available for queries and reports at any time Method used to increase concurrency: Bulk inserts
Benefits of Bulk Inserts Improved concurrency Allow application-database decoupling In Lyngby case – 50GB a day! http://www.tapuz.co.il/blog/userBlog.asp?FolderName=Hygge
Bulk Inserts & RCSI: SQLCAT Benchmark What happens when you query a table while bulk inserts are running?
Bulk Inserts & RCSI: SQLCAT Benchmark And with RCSI? Bulk loading does not affect the size of the version store in tempdb under RCSI Keep in mind: RCSI adds 14 noncompressible bytes into every row in every table Bottom line: RCSI works extremely well with bulk inserts and achieves improved concurrency More details about this benchmark: http://sqlcat.com/technicalnotes/archive/2009/04/06/bulk-loading-data-into-a-table-with-concurrent-queries.aspx
StreamInsight:Complex Event Processing SQL Server 2008 R2 feature Processing and querying of event data streams Data queried while “in flight” May involve multiple concurrent event sources Works with high data rates Aims for near-zero latency
Isn’t This Just a Database Application? Event request output stream input stream response
Other solutions Memcache Requires application change 3rd party Usually transparent
Tapuz Case Study: Offloading Traffic Tapuz is the leading user content based website in Israel 1,200 forums 74,000 blogs 500,000 visitors each month More than 4000 queries/sec Method used to increase concurrency: Offloading using Transactional Replication
Solution – Compress Data Files? No benefit in-memory Need to compress larger chunks Does not scale for random access
Solution – SQL Server 2008 / R2 Store data efficiently in the row/page (+) More data can fit in memory (+) Better Performance for I/O bound workload (-) Performance degradation for CPU bound workload
Data Compression SQL Server 2008 ROW and PAGE compression Backup Compression SQL Server 2008 R2 Unicode compression
Reporting In Production NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
Reporting In Production OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!
Resource Governor Similar to a governor you would find on a car It limits the “speed” that a SQL Server session can run at
Resource Governor – Workloads Ability to differentiate workloads based on connection property e.g. app_name, login, user, db name Per-request limits Max memory % Max CPU time Grant timeout Max Requests