In a month's time SQL Server 2012 will launch and one of the main events will be the annual SQL Server Connections - this year in Las Vegas, March 26-29. See here for registration details.

We've put together another great show (Kimberly and I are the conference co-chairs) and Kimberly, Jonathan, and I will all be there.

Here's the line-up of SQLskills sessions and workshops:

  • Full-day workshops
    • 3/25: SPR202: The Foundations of a Healthy SQL Server Database (Kimberly and Paul)
    • 3/25: SPR301: Advanced Diagnostics with SQL Server 2012 Extended Events (Jonathan)
    • 3/26: SPR203: Leveraging SQL Server 2012 Features and Tools (Kimberly and Jonathan)
    • 3/30: SPS202: Optimizing Procedural Code: Understanding Plan Cache, Procedural Code and Recompilation (Kimberly)
  • Paul's sessions
    • SQL416: Wait Statistics: Avoiding 'Knee-Jerk' Performance Tuning 
    • SQL417: Advanced Recovery Techniques 
    • SQL218: Follow the Rabbit: Wrap-up Q&A
  • Kimberly's sessions
    • SQL219: Performance Tuning through Indexing 
    • SQL320: Statistics: What, Why and How the Optimizer Uses Them
    • SQL218: Follow the Rabbit: Wrap-up Q&A
  • Jonathan's sessions
    • SQL307: Deadlocking for Mere Mortals 
    • SQL208: Distributed Replay in SQL Server 2012 

We also have sessions from well-known SQL Server experts Brent Ozar, Aaron Bertrand, Allen White, Glenn Berry, Peter Myers, Steve Hughes, Grant Fritchey, Steve Jones, Brad McGehee (the last three representing SQL Server Central) and many more...

We hope to see you there!

Categories:
Conferences

Time for another survey - this time around memory configuration.

Here is some code to run if you're on SQL Server 2008 and 2008 R2 (thanks Jonathan!):

SELECT
    [physical_memory_in_bytes] AS [PhysMemBytes],
    [physical_memory_in_use_kb] AS [PhysMemInUseKB],
    [available_physical_memory_kb] AS [PhysMemAvailKB],
    [locked_page_allocations_kb] AS [LPAllocKB],
    [max_server_memory] AS [MaxSvrMem],
    [min_server_memory] AS [MinSvrMem]
FROM
    sys.dm_os_sys_info
CROSS JOIN
    sys.dm_os_process_memory
CROSS JOIN
    sys.dm_os_sys_memory
CROSS JOIN (
    SELECT
        [value_in_use] AS [max_server_memory]
    FROM
        sys.configurations
    WHERE
        [name] = 'max server memory (MB)') AS c
CROSS JOIN (
    SELECT
        [value_in_use] AS [min_server_memory]
    FROM
        sys.configurations
    WHERE
        [name] = 'min server memory (MB)') AS c2

On 2012, the code is (thanks Bob!):

SELECT
    [physical_memory_kb] AS [PhysMemKB],
    [physical_memory_in_use] AS [PhysMemInUseKB],
    [available_physical_memory_kb] AS [PhysMemAvailKB],
    [locked_page_allocations_kb] AS [LPAllocKB],
    [max_server_memory] AS [MaxSvrMem],
    [min_server_memory] AS [MinSvrMem]
FROM
    sys.dm_os_sys_info
CROSS JOIN
    sys.dm_os_process_memory
CROSS JOIN
    sys.dm_os_sys_memory
CROSS JOIN (
    SELECT
        [value_in_use] AS [max_server_memory]
    FROM
        sys.configurations
    WHERE
        [name] = 'max server memory (MB)') AS c
CROSS JOIN (
    SELECT
        [value_in_use] AS [min_server_memory]
    FROM
        sys.configurations
    WHERE
        [name] = 'min server memory (MB)') AS c2

And on 2005/2000, if you want to participate, send me the amount of memory on the Windows server, plus the min and max server memory configuration for SQL Server. There's some PowerShell in one of the early comments that will help (thanks Eric!).

You can either send me email with the info or leave a comment on this post. I'll editorialize the results in a couple of weeks.

Thanks!

Categories:
Memory | Surveys

 

(A pair of Much-Desired Flabellinas mating.)

We spent most of January in Indonesia and as part of the trip we spent 11 days on the fabulous Paradise Dancer live-aboard dive boat diving in the most bio-diverse waters in the world. The reefs were really healthy and there was an overwhelming abundance of life under the waves. I can strongly recommend the Aggressor and Dancer live-aboard boats!

In this post I want to show you the creatures that I like seeing the most - nudibranchs (sea slugs) and flatworms. I photographed an incredible 61 separate species on 36 dives - a record that's going to be hard to beat! Here are my favorite 20 from more than 2000 shots.

Click each image for a 1024x768 version. Let me know if you'd like a full-size copy of any for a desktop background. Enjoy!

Left to right below: Thysanozoon nigropapillosum (Yellowspot Flatworm) and Acanthozoon sp. (Papillate Flatworm).

 

Left to right below: Long-Cirri Phyllodesmium and Black-Margined Glossodoris.

 

Left to right below: Tyron's Resbecia mating and Serena's Notodoris.

 

Left to right below: Giant Hypselodoris and Willan's Chromodoris.

 

Left to right below: Elegant Phyllidia and Giant Hypselodoris just about to mate.

  

Left to right below: Serpent Pteraeolidia and Thysanozoon nigropapillosum (Yellowspot Flatworm) free-swimming on a night dive.

  

Left to right below: Dusky Nembrotha and Pseudobiceros bedfordi (Elegant Flatworm).

 

Left to right below: Anne's Chromodoris and Loch's Chromodoris.

 

Left to right below: Celestial Phyllidia mating and Purple-Edged Ceratosoma.

  

Below: Scalloped Ceratosoma.

 

Back in January I posted the results of the cluster key size survey I ran in 2011 and explained how the larger the cluster key is on your table, the more space is being wasted in all the nonclustered index rows. Check it out if you haven't already.

I've finally put together the code that will run through all your databases and give you a per-table indication of how much space is being taken up by cluster keys in nonclustered indexes, and the potential space savings if you converted the cluster key to a single 8-byte bigint. You can get it below or from here: KeySpaceSavingsSingleResultSet.zip (1.57 kb)

You can mess around with the code to do what you want. And I'm continuing to use sp_msforeachdb because it's the fastest way for me to knock out code for you, and it continues to irritate my good friend Aaron Bertrand :-)

Enjoy!

/*============================================================================
  File:     KeySpaceSavingsSingleResultSet.sql

  Summary:  Potential cluster key space savings

  SQL Server Versions: 2005 onwards
------------------------------------------------------------------------------
  Written by Paul S. Randal, SQLskills.com

  (c) 2012, SQLskills.com. All rights reserved.

  For more scripts and sample code, check out
   
http://www.SQLskills.com

  You may alter this code for your own *non-commercial* purposes. You may
  republish altered code as long as you include this copyright and give due
  credit, but you must obtain prior permission before blogging this code.
 
  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF
  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  PARTICULAR PURPOSE.
============================================================================*/

IF EXISTS (SELECT * FROM msdb.sys.objects WHERE [name] = 'SQLskillsIKSpace')
    DROP TABLE msdb.dbo.SQLskillsIKSpace;
GO
CREATE TABLE msdb.dbo.SQLskillsIKSpace (
    DatabaseID SMALLINT,
 SchemaName SYSNAME,
 ObjectName SYSNAME,
    ObjectID INT,
    IndexCount SMALLINT DEFAULT (0),
    TableRows BIGINT DEFAULT (0),
    KeyCount SMALLINT DEFAULT (0),
    KeyWidth SMALLINT DEFAULT (0));
GO

EXEC sp_MSforeachdb
    N'IF EXISTS (SELECT 1 FROM (SELECT DISTINCT [name]
    FROM sys.databases WHERE [state_desc] = ''ONLINE''
        AND [database_id] > 4
        AND [name] != ''pubs''
        AND [name] != ''Northwind''
        AND [name] != ''distribution''
        AND [name] NOT LIKE ''ReportServer%''
        AND [name] NOT LIKE ''Adventure%'') AS names WHERE [name] = ''?'')
BEGIN
USE [?]

INSERT INTO msdb.dbo.SQLskillsIKSpace
(DatabaseID, SchemaName, ObjectName, ObjectID)
SELECT DB_ID (''?''), SCHEMA_NAME (o.[schema_id]), OBJECT_NAME (o.[object_id]), o.[object_id]
FROM sys.objects o
WHERE o.[type_desc] IN (''USER_TABLE'', ''VIEW'')
    AND o.[is_ms_shipped] = 0
    AND EXISTS (
        SELECT *
        FROM sys.indexes
        WHERE [index_id] = 1
            AND [object_id] = o.[object_id]);

UPDATE msdb.dbo.SQLskillsIKSpace
SET [TableRows] = (
    SELECT SUM ([rows])
    FROM sys.partitions p
    WHERE p.[object_id] = [ObjectID]
    AND p.[index_id] = 1)
WHERE [DatabaseID] = DB_ID (''?'');
 
UPDATE msdb.dbo.SQLskillsIKSpace
SET [IndexCount] = (
    SELECT COUNT (*)
    FROM sys.indexes i
    WHERE i.[object_id] = [ObjectID]
    AND i.[is_hypothetical] = 0
    AND i.[is_disabled] = 0
    AND i.[index_id] != 1)
WHERE [DatabaseID] = DB_ID (''?'');

UPDATE msdb.dbo.SQLskillsIKSpace
SET [KeyCount] = (
    SELECT COUNT (*)
    FROM sys.index_columns ic
    WHERE ic.[object_id] = [ObjectID]
    AND ic.[index_id] = 1)
WHERE [DatabaseID] = DB_ID (''?'');

UPDATE msdb.dbo.SQLskillsIKSpace
SET [KeyWidth] = (
    SELECT SUM (c.[max_length])
    FROM sys.columns c
    JOIN sys.index_columns ic
    ON c.[object_id] = ic.[object_id]
    AND c.[object_id] = [ObjectID]
    AND ic.[column_id] = c.[column_id]
    AND ic.[index_id] = 1)
WHERE [DatabaseID] = DB_ID (''?'');

DELETE msdb.dbo.SQLskillsIKSpace
WHERE
    ([KeyCount] = 1 AND [KeyWidth] < 9)
    OR [IndexCount] = 0 OR [TableRows] = 0;

END';
GO

SELECT
 DB_NAME ([DatabaseID]) AS [Database],
 [SchemaName] AS [Schema],
 [ObjectName] AS [Table],
    [IndexCount] AS [NCIndexes],
    [KeyCount] AS [ClusterKeys],
    [KeyWidth],
    [TableRows],
    [IndexCount] * [TableRows] * [KeyWidth] AS [KeySpaceInBytes],
    ([IndexCount] * [TableRows] * ([KeyWidth] - 8)) AS [PotentialSavings]
FROM msdb.dbo.SQLskillsIKSpace
ORDER BY [PotentialSavings] DESC;

DROP TABLE msdb.dbo.SQLskillsIKSpace;
GO

 

Theme design by Nukeation based on Jelle Druyts