page 1 sql server myths xv encontro da comunidade sqlport rui ribeiro mcitp 2011/08/16

20
Page 1 SQL Server Myths XV ENCONTRO DA COMUNIDADE SQLPORT Rui Ribeiro MCITP 2011/08/16

Upload: valerie-eaton

Post on 02-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1

SQL Server Myths

XV ENCONTRO DA COMUNIDADE SQLPORT

Rui RibeiroMCITP

2011/08/16

Page 2

SQL Server Myths

• An index FILLFACTOR is NOT used by regular DML operations

– True or False ?

Page 3

SQL Server Myths

• An index FILLFACTOR is NOT used by regular DML operations

- True !

From Books Online: “Important: The fill-factor setting applies only when the

index is created, or rebuilt. The SQL Server Database Engine does not dynamically keep the specified percentage of empty space in the pages. Trying to maintain the extra space on the data pages would defeat the purpose of fill factor because the Database Engine would have to perform page splits to maintain the percentage of free space specified by the fill factor on each page as data is entered.”

Page 4

SQL Server Myths

• Once a backup completes, YOU CAN safely delete the previous one !

– True or False ?

Page 5

SQL Server Myths

• Once a backup completes, YOU CAN safely delete the previous one !– False !

“If you go to restore, and you find your full backup is corrupt, what do you do? Well, if you don't have an older full backup, you most likely start updating your resume. You need to keep a rolling-window of backups around in case a disaster occurs and you need to restore from an older set of backups.”

Page 6

SQL Server Myths

• Log backups ALWAYS clear the log !

– True or False ?

Page 7

SQL Server Myths

• Log backups ALWAYS clear the log !– False !

“If there's no concurrent data backup running, a log backup will always try to clear the log, and only succeed in clearing the inactive portion of the log - the log that's only considered 'required' by SQL Server because it hasn't yet been backed up. If anything else is holding the log 'required', it cannot be cleared, even though it has been backed up. Subsequent log backups will check again and again until the time comes when that portion of the log can be cleared.”

Page 8

SQL Server Myths

• Data type of a table IS NOT a key criteria while doing query tuning !

– True or False ?

Page 9

SQL Server Myths

• Data type of a table IS NOT a key criteria while doing query tuning !– False !

“Data types decide how many rows can fit into a page. A wrong data type may consume 1000’s of excess data pages. This will directly affect IO.

A simple char(100) can do this. Be cautious in choosing data types.”

Page 10

SQL Server Myths

• NULL won’t occupy space in SQL Server !

– True or False ?

Page 11

SQL Server Myths

• NULL won’t occupy space in SQL Server ! - Depends ... (True & False ...)

“Yes for Variable length columns and No for Fixed length columns

You can create a table with nullable fixed & variable length columns and check PAGE content.”

Page 12

SQL Server Myths

• Log backups WILL BE the size of the log !

– True or False ?

Page 13

SQL Server Myths

• Log backups WILL BE the size of the log !– False ?

“The log has to accommodate the space necessary to roll back active transactions, the amount of space returned by DBCC SQLPERF (LOGSPACE) on a busy system doesn't accurately reflect the amount of log records in the log. (…) And apart from that, a log backup is just all the log generated since the last log backup - not the whole log file usually - and if it happens to be, the first part of the explanation comes into play.”

Page 14

SQL Server Myths

• If the backup works, the restore WILL too!

– True or False ?

Page 15

SQL Server Myths

• If the backup works, the restore WILL too!– False !

“Please don't fall into this trap. You must regularly validate your backups to give yourself a high level of confidence that they will work if a disaster occurs.”

Page 16

SQL Server Myths

• Truncate CANNOT be rolled back because it’s not a fully logged and only page deallocations is recorded !

– True or False ?

Page 17

SQL Server Myths

• Truncate CANNOT be rolled back because it’s not a fully logged and only page deallocations is recorded !– False !

• “You can rollback data from TRUNCATE

IF surrounded by a transaction and session is not closed.”

Page 18

SQL Server Myths

• QUESTIONS ?

Page 19

SQL Server Myths

• References:– http://www.sqlservercentral.com/blogs/

livingforsqlserver/archive/2011/06/28/my-favourite-sql-server-myths-and-realities.aspx

– http://www.sqlskills.com/blogs/paul/CommonSQLServerMyths.pdf

Page 20

SQL Server Myths