Anything SQL: Lightning Talks
-
Upload
sql-server-sri-lanka-user-group -
Category
Data & Analytics
-
view
35 -
download
0
description
Transcript of Anything SQL: Lightning Talks
Anything-SQL
Lightning Talks
My data-mart is better than your data warehouseGogula Aryalingam Business Intelligence
01
Navantis
Thank you
My data-mart is better than your data warehouse
TRY… CATCH…
Shiham Samsudeen T-SQL
02
Zone 24x7
TRY… CATCH… Alien ?
• Your Code in the TRY block• Check for the Errors in the CATCH block
Can be found in Modern Programming Languages
TRY… CATCH…T-SQL Style
• Your SQL Statement in the TRY block• Check for the Errors in the CATCH block
Find it in Transact-SQL
sql_statement: any Transact-SQL statement
statement_block : any group of Transact-SQL statements
in a batch or enclosed in a BEGIN…END block.
Why your code FAILED?List of SQL Server functions to identify:
ERROR_NUMBER() returns the number of the error
ERROR_SEVERITY() returns the severity of the error
ERROR_STATE() returns the error state number
ERROR_PROCEDURE() returns the name of the stored procedure or trigger where the error occurred, this will be NULL if you run an ad-hoc SQL statement
ERROR_LINE() returns the line number inside the routine that caused the error
ERROR_MESSAGE() returns the complete text of the error message. The text includes the values supplied for any substitutable parameters, such as lengths, object names, or times
NEED to see some T-SQL
Nice Result
Check out what being selected
out?
What can we do with this ?
I will Hold Error Info
I will Fill the Error Info
Error Occurs…Recording Error Info
Take Out the Error Info.
Results!
Error 1
Error 2
Error 3
Information is Wealth! the ability to log all errors plus any other information you want to capture like
user name, host name etc with 1 Stored Proc that you can call from everywhere
Take Home with You,
the ability to do anything with the logged
data Once YOU have it.
I CAN NOT do ANYTHING on SOMETHING until I have that THING!
Thank you
Try… Catch…
Parameter Sniffing
Susantha Bathige T-SQL
03
Pearson Lanka
Thank you
Parameter Sniffing
Data Compression
Sudesh Wijayatilake Performance Tuning
04
Finlays Colombo PLC
The Feature• The Data Compression feature of
SQL Server, can reduce the storage footprint of your databases.
– Often, data compression may lead to degrade in CPU performance due to compress/decompress; • However, SQL Server 2008 data
compression simply stores data more efficiently in the rows and pages, which means that the in-memory storage and IO Operations data management is efficient.
Mainly 2 Types of Compression
• SQL Server 2008 supports 2 specific types of data compression methods:– Row Compression
• lower level which stores the fixed character strings by using variable-length format by not storing the blank characters. NULL and 0 values across all data types are optimized and take no bytes.
– Page Compression• Is Higher level compressing & uses two types of compression
– Prefix - Prefix compression works on common values pattern across all rows on the page
– Dictionary - Works on exact values match pattern across all pages.
Considerations• Data compress very well:
– Columns with numeric or fixed-length character data types where most values don’t require all the allocated bytes: For example, integers where most values are less than 1000
– Null-able columns where a significant number of the rows have a NULL value for the column
– Significant amounts of repeating data values or repeating prefix values in the data
• Some patterns of data that do not benefit much from compression are:
– Columns with numeric or fixed-length character data types where most values require all the bytes allocated for the specific data type
– Not much repeating data– Repeating data with non-repeating prefixes– Data stored out of the row– FILESTREAM data
• Compression is Version dependant [Cannot be decompressed on another version]
Implement Data compression
• You can implement both types of data compression when you create a table or index, or by altering existing tables and indexes. You can do this by using Transact-SQL code or the Data Compression Wizard.
USE [AdventureWorks] Go
/*Estimating how much space can be saved by row or page*/EXEC sp_estimate_data_compression_savings 'Sales', 'SalesOrderDetail', NULL, NULL,'ROW' ;Go
EXEC sp_estimate_data_compression_savings 'Sales', 'SalesOrderDetail', NULL,NULL, 'PAGE' ;GO---------------------------------------------------------------------------------------------------------------/*Enabling Table compression by row or page */ALTER TABLE Sales.SalesOrderDetailREBUILD WITH (DATA_COMPRESSION = ROW); –OR
ALTER TABLE [Sales].[SalesOrderDetail] REBUILD PARTITION = ALLWITH (DATA_COMPRESSION = PAGE)
Referred from
http://msdn.microsoft.com/en-us/library/dd894051(v=sql.100).aspx
Bolt of Lightening
Queries and Share Your Findings
• Please email me [email protected]
–OR upload to our SQL Server Universe sitehttp://www.sqlserveruniverse.com/ forums
Thank you
Data Compression
Table Variables, The good and the bad
Supun Thrikawala Performance Tuning
05
CAM Management Solutions
Thank you
Table variables, the good and the bad
SQL Server Standards
Avantha Siriwardana General
06
CAM Management Solutions
Thank you
SQL Server Standards