SQL Saturday #244 is fast approaching and I will be speaking about indexes. This will be a beginner level session aimed at helping you understand what indexes are, how to use them and what to look out for. Don't miss it.
I am also looking forward to hearing Gail Shaw discussing database corruption. The schedule is online at http://www.sqlsaturday.com/244/schedule.aspx.
See you there!
Monday 2 September 2013
SQL Saturday #244 Johannesburg 2013
Wednesday 22 May 2013
Code Horrors
I just stumbled across a
strange piece of code, albeit a small one. I thought I would create a blog post
to start collecting these gems.
Item 1
SELECT
@RowIndex = RowID
FROM
CBT
WHERE
RowID = 1;
which actually means
SELECT @RowIndex = 1;
Item 1
SELECT
@RowIndex = RowID
FROM
CBT
WHERE
RowID = 1;
which actually means
SELECT @RowIndex = 1;
Monday 20 May 2013
Fixing Database Corruption in a VLDB
A client of mine phoned me last week with an error message that had appeared in their application. My worst fears were confirmed when I heard the words "logical consistency-based I/O error".
The error message reported was:
SQL Server detected a logical consistency-based I/O error: incorrect checksum (expected: 0x31b2521f; actual: 0x4bd50f4c). It occurred during a read of page (3:8191715) in database ID 17 at offset 0x00000f9fdc6000 in file 'C:\MSSQL\Data\Data2.ndf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
The error message reported was:
SQL Server detected a logical consistency-based I/O error: incorrect checksum (expected: 0x31b2521f; actual: 0x4bd50f4c). It occurred during a read of page (3:8191715) in database ID 17 at offset 0x00000f9fdc6000 in file 'C:\MSSQL\Data\Data2.ndf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
Monday 18 February 2013
Heaps Of Trouble
I recently came across a situation at a client which I
thought I would share with you. I came across this while doing some routine
maintenance and noticed a small table consuming a lot of memory. I mean this
table, which is a smallish lookup table, was consuming almost 430 MB of buffer
space. The thing about lookup tables and the way they are used is that the
entire table is usually read into memory. This is by design but the problem
here is that there should be no way that this table needs 430 MB.
SQL Server 2012: Restore Fails With Deadlock
We had an interesting situation at a client where we could not restore a SQL Server 2008 R2 backup onto SQL Server 2012. The restore would fail at 100% with a deadlock.
Isolation Levels
As a follow up to my NOLOCK blog I thought it would be a
good idea to discuss the five different isolation levels in SQL Server. These
are as follows:
NOLOCK!
I see many developers writing SQL code and using NOLOCK as a "performance tool". I see NOLOCK spread liberally through scripts, applied to every single table as far as the eye can see. This technique is dangerous and I would like to share why.
Labels:
Isolation Levels,
NOLOCK,
Read Uncommitted,
SQL Server
Subscribe to:
Posts (Atom)