Upload
atidan
View
494
Download
1
Tags:
Embed Size (px)
Citation preview
SQL SERVER DATA TOOLS
Declarative, model based database development
Integrated tools with modern language services
Connected and offline with local testing
Target SQL Server (2012, 2008 R2, 2008, 2005) and Azure SQL Database
Publish (Direct, via SQL script, or DACPAC)
Support for “Snapshots” - point-in-time representation of the schema
BUILD IN OPEN DEV ENVIRONMENTS Quickly build database applications with Visual Studio, Java, PHP, & Ruby
VISUAL STUDIO 2012
SQL Server database projects (*.sqlproj) are supported in all Visual Studio 2012 SKUs Supported in VS2010 Professional+, with exception of the Express editions
Replaces the Visual Studio 2010 database projects (*.dbproj)
Codebases will be maintained in sync (VS2010 and VS2012)
Project (*.sqplproj) system round trips between VS2010 and VS2012
Free VS2012 hosted SSDT version based on VS2012 Isolated Shell
INTRODUCING DATA TIER APPLICATIONS!
Self contained database entity used by an application Single unit of deployment and lifecycle management
DAC Packages (.dacpac/.bacpac) Authored alongside your application code
Extracted from existing database
Deployable to SQL Server and Windows Azure SQL Databases
Consistent story for database development, migration, and versioning across the SQL Server platform
PACKAGE ARTIFACTS
.dacpac Packaged schema representing the declarative model of the database
Not SQL, but a declarative Schema Model representation of the database
Compiled from source code or Extracted from existing databases
Deploy as new database or Upgrade an existing database
Supports all SQL Server database objects and types
.bacpac Packaged schema and data representing the state of the database
Composed of Schema Model with state-ful properties and Data streams
Exported from existing databases
Imported as a new database or populates an empty database
Supports most SQL Server database objects and types (Azure Parity)
DAC FRAMEWORK (DACFX)
Core SQL Server component providing modeling, reverse engineering, and deployment capabilities
A QUICK DAC HISTORY
DAC 1.0 SQL Server 2008 R2 Utility
VS 2010 SP1 DAC Project
DAC 1.1 – Upgrade in Place
DAC 2.0 – Object support for SQL Azure, BACPAC
DAC 3.0 SQL Server 2012/SQL Server Data Tools
Object support for SQL Server 2005-above, SQL Azure
DACFX OBJECT SUPPORT AND COMPAT
SQL Server 2012 DACFx (v3.0) supports full SQL Server database domain SQL Server 2005
SQL Server 2008/R2
SQL Server 2012
Windows Azure SQL Databases
DACFx (v3.0) backwards compatibility Back-compat for DACFx 1.0, 1.1, and 2.0
DAC IN SQL SERVER DATA TOOLS (SSDT)
Developer-focused toolset for authoring, building, and publishing DACPACs Experiences Enabled
Connected Imperative and Declarative Development
Project Based Development
Application Lifecycle & Tools
DACPAC Actions
Build/Snapshot
Compare
Import into Project
Publish
WHAT DOES IT DO?
SQL Server Data Tools/DACFx features include: Building a DACPAC from a set of T-SQL scripts
Extracting a DACPAC from a database
Deploying a DACPAC to a new database
Incrementally upgrading an existing database schema via DACPAC
Exporting a BACPAC from an existing database
Importing a BACPAC to a new/empty database
Schema comparison
Online Database Development Tools
WHAT'S THE POINT?
Provides services around SQL Server Database extraction and packaging
File formats are SQL Server version-independent
DAC features enable Managed database application lifecycle
Schema and data portability
WHAT PROBLEM DOES IT SOLVE?
Meant to simplify deployment across SQL Server release/version differences
Features, T-SQL dialect
SQL Azure vs. SQL Server
T-SQL dialect, other differences
Others…
Migrating database between instances On Prem => SQL Azure and back or between On Prem
DAC IN SQL SERVER MANAGEMENT STUDIO (SSMS)
DBA-focused tools for creating, deploying, and managing DAC packages
DACFX 3.0 IN SSMS 2012
On SQL Server or SQL Azure node in Object Explorer
Databases Folder Deploy (from DACPAC)
Import (from BACPAC)
Local file system or Windows Azure storage
Individual Databases/Tasks Extract
Migrate Database to Azure (using BACPAC)
Export (to BACPAC)
Local file system or Windows Azure storage
Register
Upgrade
Delete (Unregister)
NEW QUERY & SCHEMA CONSTRUCTS
Support for Simplified Paging SELECT...
ORDER BY ...
OFFSET <expr> ROWS
FETCH NEXT <expr> ROWS ONLY
Support for UTF-16, introducing _SC collations Common Unicode characters occupy 16-bits each (NCHAR / NVARCHAR)
Rarer Unicode characters occupy 2 x 16-bits each
“Supplementary Characters”, “Surrogate Pairs”
Ancient scripts; Music Notation; Math Symbols etc.
SEQUENCES
New Sequence Object , similar to the IDENTITY property
Separates number-generation from column and table
ANSI standard compliant implementation
EXCEPTIONS & MESSAGES
Use cases: Send progress updates to the application
Log events
Raise & handle exceptions
Options: RAISERROR
xp_logevent
Logging table
NEW: THROW
NEW ERROR HANDLING WITH THROW
THROW <number>, <message>, <state>; Always aborts the batch
Batch aborts if not in SET XACT_ABORT ON where it
transaction-aborts
Does not automatically use sys.messages
Is even spelled correctly!
re-THROW BEGIN CATCH
…;
THROW;
END CATCH
CALCULATIONS & AGGREGATIONS
Use cases: Include aggregations in details
Cumulative sum, averages etc.
Reference other rows in a calculation
Finding gaps, trends, etc.
Options: Imperative programming patterns
Correlated sub queries
NEW: Window Functions
CALCULATIONS ACROSS ROWS
Referencing same row is simple: Transaction cost is $1.5/tran., what was
the total amount?
Amount + 1.5 AS TotalAmount
What about other rows? Current bank balance?
Current account balance?
Number of days since last tran.?
Amount of previous transaction?
WINDOW FUNCTIONS
Aggregation AVG, CHECKSUM_AGG, COUNT, COUNT_BIG, MIN, MAX, SUM, STDEV, STDEVP, VAR, VARP
User-defined CLR Aggregates (excl. windowing)
Analytical ROW_NUMBER, NTILE, RANK, DENSE_RANK, CUME_DIST, PERCENT_RANK
Distribution PERCENTILE_CONT, PERCENTILE_DISC
Offset LAG, LEAD, FIRST_VALUE, LAST_VALUE
COMMON TASKS
Use cases: Transform data to and from strings
Constructing date instances
Handle conversion errors
Paging
Options: Write yourself
NEW: Additional scalar functions
ADDITIONAL SCALAR FUNCTIONS
New conversion functions for all types: TRY_CONVERT(data_type[(length)], [,style])
TRY_CAST(expression AS data_type[(length)])
New conversion functions to and from strings: FORMAT(value, format [,culture])
PARSE(string_value AS data_type [USING culture])
TRY_PARSE(string_value AS data_type [,USING culture])
Other functions: IIF(boolean expr, true_value, false_value)
CHOOSE(index,val1,val2 [,valN])
CONCAT(val1, val2…[,valn])
ADDITIONAL SCALAR FUNCTIONS
New date & time related functions: EOMONTH(date [, months_to_add])
DATEFROMPARTS(year, month, day)
TIMEFROMPARTS(hour, minutes, seconds, fractions, scale)
DATETIME2FROMPARTS(year, month, day ,hour, minutes, seconds,
fractions, scale)
DATETIMEFROMPARTS(year, month, day, hour, minutes, seconds, miliseconds)
SMALLDATETIMEFROMPARTS(year, month, day, hour, minutes)
CLOUD ENABLE SQL SERVER
Better Integration with Azure Platform Logical backup to Azure Storage
Move database to SQL Azure
Import database from Azure Storage
SQL Azure Management with SSMS Support for Federations
PRODUCTIVITY ENHANCEMENTS Enhanced developer experience
Intellisense Substring matching in completion list
Error handling & performance improvements
Code snippets Use your own code snippets
Share snippets with team members
Keyboard shortcuts default = ‘SQL 2008 R2 compatible’
Assign shortcuts to frequently used stored procedures
Share with team and between SSMS & SQL Studio
PRODUCTIVITY ENHANCEMENTS Better T-SQL debugging
Conditional Breakpoints Breakpoint validation
Expression evaluation in Watch window
DataTips and Pinned DataTips
Features available when debugging… SQL Server 2005
SQL Server 2008
SQL Server 2008 R2 instances
PRODUCTIVITY ENHANCEMENTS Management
Log Viewer View SQL Server logs for offline + online instances
Improved Search & Better performance
Database Recovery Advisor Spend lesser time on restore operations
Analyze backup files from a folder (not just from msdb)
‘Point in Time’ & Page Level restores
Construct correct & optimal restore sequence
Check for corrupted pages
Extended Events
BEYOND RELATIONAL IN SQL SERVER 2012
Address important customer requests for Capabilities and rich services for Rich Unstructured Data (RUDS) Scale Up for storage and search to 100mio to 500mio documents
Easy use/access to Unstructured data from all applications
Rich insight into unstructured data to make better decisions
We deliver what you asked for to build Spatial-aware
Applications Advanced 2D Spatial
Make Spatial pervasive across platform
Developer Agility Part of the Paradigms driving NoSQL adoption
Can easily evolve data tier driven by Application and Business requirements from within the
Application
Multi-Tenancy with heterogeneous schemas
Databases with heterogeneous record types in a table Type specific properties, inherited properties in a type hierarchy
Examples: Product catalogs (Commerce Server), Location/business specific properties (Maps)
Item-Level Property bag scenarios Distinct customized property sets associated with data
Large number of unique properties, user annotations
Examples: Document management systems (SharePoint), Media stores
Large number of sparsely populated properties
Distinct property sets
Heterogeneous structures
Evolving and co-existing structures
Sets, nested structures
Forum and mailing list threads
Business organization charts
Content management categories
Product categories
Files/folders management
A system data type with variable length CLR UDT
Microsoft.SqlServer.Types
Varbinary encoding ( < 900 bytes)
To represent position in a hierarchy
Logically encodes the path from the root of the tree to a node
Rich built-in methods for manipulating hierarchies
Simplifies storage and querying of hierarchical data
Comparison a<b is in depth-first order
Support for arbitrary insertions and deletions
Pro: Simple range scans to find descendants or ancestors with QP support
(trie-statistics)
Provide depth first clustering
Simple query for specific ID or IDs of a parent/children (benefits from
clustering)
Cons: Programming model not the easiest
Nesting level limited by the datatype size (but still enough)
Wide Sparse Table: only rows that have a value for the property have a value, others are NULL
“Sparse” as a storage attribute on a column Storage Optimization: 0 bytes stored for a NULL value
Co-location of data: Performance benefits
NULL Compression in the TDS layer
No change in Query/DML behavior
Wide Tables/Column Sets Large number of sparse columns allowed in a table (30,000 Columns, 1000 indexes, 30,000 statistics)
Requires defining a “Sparse Column Set”
An un-typed XML column, with a published format
Logical grouping for all sparse columns in a table
Select * returns all non-sparse-columns, sparse column set (XML)
Allows generic retrieval/update of all sparse columns as a set
SPARSE COLUMN STORAGE
0 Bytes stored for NULL Values ~20% CPU overhead for non-null value access
Additional 2- 4 bytes for non-null values
Sparse columns are beneficial when space savings >40%
FILTERED INDEXES
Filtered Indexes and Statistics Indexing a portion of the data in a table
Filtered/co-related statistics creation and usage
Query/DML Optimization to use filtered indexes and statistics
Restrictions Simple limited grammar for the predicate
Only on non-clustered indexes
Benefits Lower storage and maintenance costs for large number of indexes
Query/DML performance benefits: IO only for qualifying rows
XML is ubiquitous, extensible, platform independent transport format
Message Envelope in XML Simple Object Access Protocol (SOAP), RSS, REST
Message Payload/Business Data in XML
Vertical Industry Exchange schemas
XHTML, DocBook, Home-grown, domain-specific markup (e.g. contracts), OpenOffice, Microsoft Office
XML (both default and user-extended)
Storing and querying heterogeneous complex objects
Semistructured data with sparse, highly-varying structure at the instance level
XML provides self-describing format and extensible schemas
Is format used by COLUMNSET
NEW XQUERY ALGEBRA OPERATORS XML Reader TVF
Table-Valued Function XML Reader UDF with XPath Filter
Used if no XML Index is present
Creates node table rowset in query flow
Multiple XPath filters can be pushed in to reduce node table to subtree
Base cardinality estimate is always 10’000 rows!
Some adjustment based on pushed path filters
NEW XQUERY ALGEBRA OPERATORS UDX
Serializer UDX serializes the query result as XML
XQuery String UDX evaluates the XQuery string() function
XQuery Data UDX evaluates the XQuery data() function
Check UDX validates XML being inserted
UDX name visible in SSMS properties window
XML INDICES
Create XML index on XML column CREATE PRIMARY XML INDEX idx_1 ON docs (xDoc)
Create secondary indexes on tags, values, paths
Creation: Single-threaded only for primary XML index
Multi-threaded for secondary XML indexes
Uses: Primary Index will always be used if defined (not a cost based decision)
Results can be served directly from index
SQL’s cost based optimizer will consider secondary indexes
Maintenance: Primary and Secondary Indices will be efficiently maintained during updates
Only subtree that changes will be updated
No online index rebuild
Clustered key may lead to non-linear maintenance cost
Schema revalidation still checks whole instance
SCALE-UP & ALWAYSON SUPPORT
FILETABLE OVERVIEW
CREATING A FILETABLE
DATA ACCESS – FILE SYSTEM ACCESS
MANAGING FILETABLE – HIGH AVAILABILITY
UNSTRUCTURED DATA: MULTIPLE CONTAINERS
Use of multiple spindles for achieving better I/O Scalability
SPATIAL DATA IN SQL SERVER
Storage and retrieval of spatial data using standard SQL syntax Spatial Data Types (geometry, geography)
Spatial Methods (intersects, buffer, etc.)
Spatial Indexes
Offers full set of Open Geospatial Consortium components (OGC/SQL MM, ISO 19125)
Spatial Builder Interface
SQL Server Management Studio visualization
Integration with Bing Maps
Integration with Reporting Services
CIRCULAR ARCS Geography type considerations
If a circular linestring encloses an area, a
curve polygon can be created
CURVEPOLYGON (CIRCULARSTRING
(0 50, 90 50, 180 50, 270 50, 0 50))
Coordinate pair order is important for the
geography type. This set of coordinates is
ordered according to the “left foot rule” for
exterior rings.
PERFORMING SPATIAL OPERATIONS
Find streets that intersect the Microsoft campus SELECT StreetName
FROM Streets
WHERE Streets.StreetGeo.STIntersects(@ms) = 1
HIGH PERFORMANCE SPATIAL CAPABILITIES Spatial indexing
Spatial indexing is built into the query engine Grid-based quad-tree index structure
Query optimizer determines cost-based query plans
PERFORMANCE ENHANCEMENTS FOR SPATIAL APPLICATIONS IN SQL SERVER 2012
Support Persisted computed spatial columns
New geodetic SRID for faster calculations
Improved implementation of operations Faster Spatial index creation for point data (4 to 5 times faster)
Faster point data queries
Optimized STBuffer, lower memory footprint
Faster “secondary” filter step
Improved default spatial indexing scheme and new hints AutoGrid
Query Window Grid density hint
Spatial Index Compression
Improved index-aware query plans Nearest Neighbor
Optimized spatial query plan for STDistance and STIntersects like queries
WHAT IS NEW IN AZURE SPATIAL SUPPORT
New Methods GEOGRAPHY Parity with GEOMETRY TYPE: STContains, STOverlaps etc
New Capabilities:
AsBinaryZM(), IsValidDetailed(), ShortestLineTo()
Spatial Aggregators:
CollectionAggregate, ConvexHullAggregate, EnvelopeAggregate*, UnionAggregate
Better Performance Nearest Neighbor Query Plan
Persisted Computed Spatial Columns
UnitSphere SRID 104001 for GEOGRAPHY
STATISTICAL SEMANTIC SEARCH
Semantic Insight into textual content Uses language models to find most important keywords in document
No need to build brittle ontologies!
Statistically Prominent Keywords
Autogenerated tag clouds
Potentially Related Content based on extracted Keywords, such as
Similar Products (based on description)
Similar Jobs or Applicants
Similar Support Incidents (based on call logs)
Potential Solutions (based on similar incidents)
First class usage experience Efficent linear algorithms
Integrated with FTS and SQL
New Rowset functions for all results using SQL query
FUNCTIONAL SURFACE: INITIATE SEMANTICS
Create / Alter Full-Text with Semantics Makes internal design dependency on FTS explicit
Virtual Machine Manager
› P2V conversion of SQL Server instances
› Conversion of virtual SQL Server
instances from VMware Hyper-V
› Faster creation of SQL Server VMs
based on pre-built template with SQL
Server SysPrep
› Creation of database application
profiles inside SQL Server VMs based
on SQL Server data-tier applications
(DACs)
› Creation & management of private
cloud based on SQL Server VMs
App Controller
› Self-Service, role-based management of SQL Server
VMs in private cloud & public cloud
› Deployment of SQL Server VM across multiple private
cloud environments
› Deployment of SQL Server VM from private
to public cloud
BETTER CLOUD MANAGEMENT WITH WINDOWS SERVER TECHNICAL BENEFITS
NEXT STEPS
SQL Server 2012 Case Studies: http://www.microsoft.com/casestudies/Case_Study_Advanced_Search.aspx
(Search on SQL Technologies)
SQL Server 2012 Hands On Labs: http://www.microsoft.com/sqlserver/en/us/learning-center/virtual-labs.aspx
SQL Server 2012 Certification: http://www.microsoft.com/learning/en/us/certification/cert-sql-server.aspx
SQL Server 2012 Best Practices: http://technet.microsoft.com/en-us/sqlserver/bb671430
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.