SQLvariations: SQL Server, a little PowerShell, maybe some Hyper-V Rotating Header Image

Code

Checking Disk Space with PowerShell

This is another one of the code examples that I did in my PowerShell for Data Professionals session last week.  If you give it your computer name and then run it you will get back a stream or properties like I mentioned during the session. 

get-wmiobject -query `
"Select DeviceID,Size,Freespace from Win32_logicaldisk where drivetype=3" `
-computer "YourComputerName"

Now this runs fine but it brings back quite a bit more information than we really need.  I mean we specified columns in our WQL statement and it brought back the kitchen sink almost as if we had given it a SELECT *.  Now I don’t know why this happens I just know that it does (I have emailed a few people but haven’t heard back yet).  To get around this problemfeature all you have to do is take the output from the command you executed and pipe it to the Select-Object cmdlet and specify the columns that you want again.

get-wmiobject -query `
"Select DeviceID,Size,Freespace from Win32_logicaldisk where drivetype=3" `
-computer "YourComputerName" | select-object DeviceID, Size, FreeSpace

And voilà you have now taken something from the pipeline and done something with it that hopefully any SQL person in the world can understand.  So what’s next?  Well just change -computer again to the name of your favorite Dev server and see how much disk space you have.

*Don’t forget the disclaimer about running other people’s scripts!

Here’s the link to the msdn article that will have more info on those properties and the methods that you can use against

http://msdn.microsoft.com/en-us/library/aa394173(VS.85).aspx

Get More Done with SQLPSX

In my LiveMeeting session for the AppDev Virtual Chapter of PASS yesterday I talked about building on top of tools that others had already built for you to use.  A great one for any DBA to use is the SQL PowerShell Extensions known as SQLPSX.  Even if you’ve never used PowerShell before you should take a look at this.  Heck even Sys Admins in shops that don’t have a DBA should have a look at this.  I have found the commands I have worked with very easy to use; even easier than T-SQL in some cases.

SQLPSX

After you download the files and RTFM you can then you can follow along on this next part.  Oh wait, first a little warning straight from Buck Woody:

Script Disclaimer, for people who need to be told this sort of thing:  

Never trust any script, including those that you find here, until you understand exactly what it does and how it will act on your systems. Always check the script on a test system or Virtual Machine, not a production system. All scripts on this site are performed by a professional stunt driver on a closed course. Your mileage may vary. Void where prohibited. Offer good for a limited time only. Keep out of reach of small children. Do not operate heavy machinery while using this script. If you experience blurry vision, indigestion or diarrhea during the operation of this script, see a physician immediately.

get-module -listAvailable

import-module SQLServer

Invoke-SqlBackup -sqlserver "WINX64ULT7\Kilimanjaro" -dbname "AdventureWorks" `

-filepath "C:\Temp\AdventureWorks_db_$(((Get-Date).ToString("yyyyMMddHHmm"))).bak"

Now this little script here (above) will backup a db for you and even include the current YearMonthDayHourMinute in the file string.  This one below will backup all of the non-system databases on your instance.  If you’re like me you’re thinking this doesn’t do anything that you can’t already do today with a maintenance plan.  That’s true and maybe I should have titled this post “Get Something Done with SQLPSX” but I will build on how you can leverage this more tomorrow.  For now, why don’t you add an AND clause only backup all the databases that start with ‘A’ ;-)

foreach ($dbn in invoke-sqlcmd -query "SELECT name  FROM sys.databases WHERE owner_sid !=0x01" `

-database master -serverinstance WIN7\Kilimanjaro )

{

$k="C:\Temp\" + $($dbn.name) + "_db_$(((Get-Date).ToString("yyyyMMddHHmm"))).bak"WIN7\Kilimanjaro" -dbname $($dbn.name)  -filepath $k

$dbn; Invoke-SQLBackup -sqlserver "

}

I’ve gone ahead and included the SQLPSX help items here.  Please see if there’s one that catches your eye and see if it might work for you.

* Get-AgentAlert

* Get-AgentAlertCategory

* Get-AgentJob

* Get-AgentJobHistory

* Get-AgentJobSchedule

* Get-AgentJobServer

* Get-AgentJobStep

* Get-AgentOperator

* Get-AgentOperatorCategory

* Get-AgentProxyAccount

* Get-AgentSchedule

* Get-AgentTargetServer

* Get-AgentTargetServerGroup

* Set-AgentJobHistoryFilter

* Get-ReplArticle

* Get-ReplEnumLogReaderAgent

* Get-ReplEnumPublications

* Get-ReplEnumPublications2

* Get-ReplEnumSnapshotAgent

* Get-ReplEnumSubscriptions

* Get-ReplEnumSubscriptions2

* Get-ReplLightPublication

* Get-ReplMonitor

* Get-ReplPublication

* Get-ReplPublicationMonitor

* Get-ReplPublisherMonitor

* Get-ReplScript

* Get-ReplServer

* Get-ReplSubscriberSubscription

* Get-ReplSubscription

* Get-ReplTransPendingCommandInfo

* New-ReplMergePublication

* New-ReplScriptOptions

* New-ReplTransPublication

* Get-GroupUser

* Get-ShowMbrs

* New-ShowMbrs

* Set-ShowMbrs

* Out-SqlScript

* Test-SqlScript

* Add-SqlDatabase

* Add-SqlDatabaseRole

* Add-SqlDatabaseRoleMember

* Add-SqlDataFile

* Add-SqlFileGroup

* Add-SqlLogFile

* Add-SqlLogin

* Add-SqlServerRoleMember

* Add-SqlUser

* Get-Sql

* Get-SqlCheck

* Get-SqlColumn

* Get-SqlConnection

* Get-SqlData

* Get-SqlDatabase

* Get-SqlDatabasePermission

* Get-SqlDatabaseRole

* Get-SqlDataFile

* Get-SqlDefaultDir

* Get-SqlEdition

* Get-SqlErrorLog

* Get-SqlForeignKey

* Get-SqlIndex

* Get-SqlIndexFragmentation

* Get-SqlInformation_Schema.Columns

* Get-SqlInformation_Schema.Routines

* Get-SqlInformation_Schema.Tables

* Get-SqlInformation_Schema.Views

* Get-SqlLinkedServerLogin

* Get-SqlLogFile

* Get-SqlLogin

* Get-SqlObjectPermission

* Get-SqlPort

* Get-SqlProcess

* Get-SqlSchema

* Get-SqlScripter

* Get-SqlServer

* Get-SqlServerPermission

* Get-SqlServerRole

* Get-SqlShowMbrs

* Get-SqlStatistic

* Get-SqlStoredProcedure

* Get-SqlSynonym

* Get-SqlSysDatabases

* Get-SqlTable

* Get-SqlTransaction

* Get-SqlTrigger

* Get-SqlUser

* Get-SqlUserDefinedDataType

* Get-SqlUserDefinedFunction

* Get-SqlVersion

* Get-SqlView

* Invoke-SqlBackup

* Invoke-SqlDatabaseCheck

* Invoke-SqlIndexDefrag

* Invoke-SqlIndexRebuild

* Invoke-SqlRestore

* New-SqlScriptingOptions

* Remove-SqlDatabase

* Remove-SqlDatabaseRole

* Remove-SqlDatabaseRoleMember

* Remove-SqlLogin

* Remove-SqlServerRoleMember

* Remove-SqlUser

* Set-SqlData

* Set-SqlDatabasePermission

* Set-SqlObjectPermission

* Set-SqlServerPermission

* Update-SqlStatistic

* Copy-ISItemFileToSQL

* Copy-ISItemSQLToFile

* Copy-ISItemSQLToSQL

* Get-ISData

* Get-ISItem

* Get-ISPackage

* Get-ISRunningPackage

* Get-ISSqlConfigurationItem

* New-ISApplication

* New-ISItem

* Remove-ISItem

* Rename-ISItem

* Set-ISConnectionString

* Set-ISPackage

* Test-ISPath

SQLServer:\SQL\Databases\Tables> Dir

Getting started talking to your SQL Servers in the PowerShell 2.0 ISE

By now hopefully you’ve noticed that SQL Server 2008 comes with PowerShell all over the place.  Just about anything you click on in Object Explorer has “Start PowerShell” and you can even execute PowerShell steps in SQL Agent Jobs. 

You may be wondering why on Earth you would want to “Start PowerShell” in the first place.  I’ll show you one thing today and then expand on that in later blog posts but today I wanted to tell you how to run PowerShell in something a little more organized than a command prompt window.  The first thing I’d like you to do is open up SSMS, connect to an instance and Right-Click the Databases folder > then select Start PowerShell.  A command prompt window should open up and from there you can talk to your SQL Server instance as if was a drive on your machine:

LaunchSQLPS

The SQLPS window that just opened up is PowerShell 1.0 with a special ‘expansion pack’ that allows it to talk to SQL Server in a way that PowerShell alone can’t.  So now that we’ve got that covered I want to show you how to do the same thing in PowerShell 2.0’s ISE. 

Go to Start > All Programs > Accessories > Windows PowerShell > Windows PowerShell ISE

Copy the code from the bottom and step through it like I did in this picture.  When you’re done you will be able to drill down to tables like they were just folders directories on your hard drive.  If you aren’t running Windows 7 (upgrade already!) check this post and see if you’re operating system is eligible.

ISE_SQL

When you get to the part where you do “get-psdrive” for the second time you should now see the SQL Server on your local machine.  If you haven’t figured out yet, this is only going to work if you have SQL Server installed on your local machine. 

#Before
get-psdrive

#Snapins that are running
get-pssnapin
#Snapins that you can load
get-pssnapin -registered

#Go ahead and add the SQL Snapins
add-pssnapin SqlServerCmdletSnapin100
add-pssnapin SqlServerProviderSnapin100

#New Resource
get-psdrive

#What can we do with that?
cd SQLSERVER:\SQL\YourComputerName\YourInstanceName\DATABASES\ADVENTUREWORKS\TABLES

Now that we have done all of that we can do something that I have seen mentioned several places but I think that Allen White’s blog post explains it the best (here’s my version of it).  You can now create a variable and populate it with one the DDL structures in your database and from there generate a Create script for it like so:

$PTH = get-item Production.TransactionHistory
$PTH.Script()

Your output should look something like this:
PS SQLSERVER:\sql\WIN7\DATABASES\ADVENTUREWORKS\TABLES> $PTH = get-item Production.TransactionHistory
$PTH.Script()
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [Production].[TransactionHistory](
 [TransactionID] [int] IDENTITY(100000,1) NOT NULL,
 [ProductID] [int] NOT NULL,
 [ReferenceOrderID] [int] NOT NULL,
 [ReferenceOrderLineID] [int] NOT NULL,
 [TransactionDate] [datetime] NOT NULL,
 [TransactionType] [nchar](1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
 [Quantity] [int] NOT NULL,
 [ActualCost] [money] NOT NULL,
 [ModifiedDate] [datetime] NOT NULL
) ON [PRIMARY]

And that’s it for this edition of how to do something when you open up the PowerShell 2.0 ISE.  Next we’ll do something more useful I promise.

Filtered Indexes: The Conversation

A few months back as one of my very first blog posts I showed off some functionality that I had learned in Bruce Payette’s book “PowerShell In Action”  (Coincidentally a new update to the MEAP for the Second Edition was released tonight).  I showed how it was not too difficult to Archive the wisdom of Paul Randal’s Tweets for the PASS Summit.  Tonight I had a conversation with Adam Machanic and wanted to save that off as well. 

I got an idea when watching Allen White talk about Filtered Indexes on Tuesday (insert obligatory AppDev VC of PASS plug here: “Allen White Presents:  SQL Server Indexing“ ).  I have a situation where I have six or seven columns that I want to index but I would prefer to only index the rows that have been created after the first 90 days.  After the first 90 days our people just don’t query those columns anywhere near as much.  My original idea was to create a filtered index on the ‘CreationDate’ column and then INCLUDE the 5 or 6 other columns that tend to get queried heavily during those first 90 days.  I also have some flash drives on my SAN that I want to use for these indexes but the drives aren’t very big and if I create the indexes across the whole table they will use up a lot of space and only a fraction of the entire index would get hit hard (very hard). 

The conversation that transpired between Adam and I was a great dive into the topic of Filtered Indexes for me; I’ve worked with them before but I’ve never tried this particular scenario before.  Adam said that this convo gave him idea to blog about.  I can’t wait to see it.  Until then you can read up on what we discussed below.
adam_machanic

Having worked with PowerShell for several more months now I have learned a few things and was able to implement them on the fly to make this process even easier.  This time instead of using the format options I just select-ed the columns that I wanted to keep out of the Pipeline and exported it to CSV.  The process of favorite’ing the individual tweets in the conversation is still a manual process; but I’m sure that a few more weeks of PowerShell learning will fix that. 

Here’s the code that I used tonight:

([xml] (new-object net.webclient).DownloadString(http://twitter.com/favorites/76699854.rss)).rss.channel.item | select description, pubDate, link | Export-CSV c:\Temp\FilteredIndexes.CSV

And now, you can read the conversation that I had with Adam Machanic without all the clutter of the other tweets during that time period:

description pubDate link
SQLvariant: Listening to Allen White speak about Indexing for the AppDev VC of #SQLPASS http://bit.ly/bgM06y Tue, 09 Feb 2010 17:03:37 http://twitter.com/SQLvariant/statuses/8862223289
MidnightDBA: I’m behind the times, work on SQL05. Can’t wait to work w/sql 08 professionally, filtered indexes are awesomesauce. Tue, 09 Feb 2010 17:10:55 http://twitter.com/MidnightDBA/statuses/8862493660
AdamMachanic: @MidnightDBA They’re not as great in practice as they seem when you first learn about them, IMO. Lots of limitations and few use cases Tue, 09 Feb 2010 17:18:54 http://twitter.com/AdamMachanic/statuses/8862783462
SQLvariant: @AdamMachanic Well then you should probably tell Allen to quit giving us good ideas on how to use them ;-) Tue, 09 Feb 2010 17:24:34 http://twitter.com/SQLvariant/statuses/8862986987
AdamMachanic: @SQLvariant Such as? Tue, 09 Feb 2010 17:49:13 http://twitter.com/AdamMachanic/statuses/8863863635
SQLvariant: @AdamMachanic Only indexing the last quarter’s worth of data. Tue, 09 Feb 2010 17:59:54 http://twitter.com/SQLvariant/statuses/8864239382
SQLvariant: @AdamMachanic … I realize that table partitioning would normally present a better solution but I can still see some useful scenarios Tue, 09 Feb 2010 18:01:14 http://twitter.com/SQLvariant/statuses/8864294018
AdamMachanic: @SQLvariant I was hoping you would send me a link or two Tue, 09 Feb 2010 18:01:43 http://twitter.com/AdamMachanic/statuses/8864311604
AdamMachanic: @SQLvariant Hmm, I’ve been thinking about only indexing last qtr w/ filtered index, and that strikes me as a really bad idea. Not only 1/? Tue, 09 Feb 2010 20:25:45 http://twitter.com/AdamMachanic/statuses/8869378189
AdamMachanic: @SQLvariant will you have to hardcode a date in the index–meaning that you’ll have to keep it up to date somehow (manually? a process?) 2/? Tue, 09 Feb 2010 20:26:15 http://twitter.com/AdamMachanic/statuses/8869395660
AdamMachanic: @SQLvariant your queries on the last qtr will also have to include that date, hardcoded, or else your plans won’t use the index 3/? Tue, 09 Feb 2010 20:27:32 http://twitter.com/AdamMachanic/statuses/8869441985
AdamMachanic: @SQLvariant ex. SELECT * FROM tbl WHERE dt > @dt — would have to either not use the idx or recompile every time 4/4 Tue, 09 Feb 2010 20:29:06 http://twitter.com/AdamMachanic/statuses/8869496991
AdamMachanic: @SQLvariant Any thoughts on my comments yesterday regarding filtered indexes and indexing for the last quarter? Thu, 11 Feb 2010 01:04:53 http://twitter.com/AdamMachanic/statuses/8928304859
SQLvariant: @AdamMachanic yes. Chewing on those now. (Just read them a few minutes ago.) Thu, 11 Feb 2010 01:05:39 http://twitter.com/SQLvariant/statuses/8928338093
SQLvariant: @AdamMachanic So on 4/4: Were you saying rebuild every time you run the query? or rebuild query every time you rebuild the index? Thu, 11 Feb 2010 01:06:55 http://twitter.com/SQLvariant/statuses/8928391399
AdamMachanic: @SQLvariant Your query has to have literals for it to use the index–I tried. It might work w/ the RECOMPILE hint but I didn’t test that Thu, 11 Feb 2010 01:41:02 http://twitter.com/AdamMachanic/statuses/8929858439
AdamMachanic: @SQLvariant So rebuild query every time you rebuild the index. And you have to have more than one query: One for most recent quarter, 1/2 Thu, 11 Feb 2010 01:41:35 http://twitter.com/AdamMachanic/statuses/8929881524
AdamMachanic: @SQLvariant … and one for all of history … and logic in your app to choose the right query. PITA! 2/2 Thu, 11 Feb 2010 01:41:54 http://twitter.com/AdamMachanic/statuses/8929894671
SQLvariant: @AdamMachanic If I only have to rebuild the queries every time that I rebuild the index that’s very doable. Thu, 11 Feb 2010 01:43:12 http://twitter.com/SQLvariant/statuses/8929949599
SQLvariant: @AdamMachanic Actually…. We already have more complex logic our app. Just put it there last month, before it was doing full scans. Thu, 11 Feb 2010 01:44:13 http://twitter.com/SQLvariant/statuses/8929992415
AdamMachanic: @SQLvariant And you want to have to re-create your indexes every quarter? Not simply run ALTER REBUILD, but actually re-create Thu, 11 Feb 2010 01:44:17 http://twitter.com/AdamMachanic/statuses/8929995070
AdamMachanic: @SQLvariant And maintain every query in the system that might rely on that index, and make sure the app chooses the right query every time? Thu, 11 Feb 2010 01:44:46 http://twitter.com/AdamMachanic/statuses/8930015395
SQLvariant: @AdamMachanic Why it was doing full scans is a long story itself. But this is definitely giving me ideas to test out. Thu, 11 Feb 2010 01:45:08 http://twitter.com/SQLvariant/statuses/8930031641
AdamMachanic: @SQLvariant But a normal index could be used instead, without all of this maintenance overhead, at the cost of storage space Thu, 11 Feb 2010 01:45:36 http://twitter.com/AdamMachanic/statuses/8930051825
SQLvariant: @AdamMachanic Not rebuild them every quarter, rebuild them every weekend to reflect the last 13 weeks. Thu, 11 Feb 2010 01:46:05 http://twitter.com/SQLvariant/statuses/8930072522
SQLvariant: @AdamMachanic Right, see that’s the thing. I’m pondering this because I want to save on storage. Thu, 11 Feb 2010 01:47:02 http://twitter.com/SQLvariant/statuses/8930112826
AdamMachanic: @SQLvariant Even worse! Thu, 11 Feb 2010 01:47:05 http://twitter.com/AdamMachanic/statuses/8930115641
SQLvariant: @AdamMachanic Here’s my situation: I have a handful of Flash drives for my @EMCCLARiiON but they’re not enough to store all of my indexes. Thu, 11 Feb 2010 01:48:09 http://twitter.com/SQLvariant/statuses/8930161731
AdamMachanic: @SQLvariant I don’t think the chance of screwing up and missing a query is worth the benefit… unless you use a macro system to 1/2 Thu, 11 Feb 2010 01:48:35 http://twitter.com/AdamMachanic/statuses/8930180307
SQLvariant: @AdamMachanic …2/2 but if some of the indexes were filtered indexes they could all fit. Thu, 11 Feb 2010 01:48:51 http://twitter.com/SQLvariant/statuses/8930191531
AdamMachanic: @SQLvariant maintain the queries… hmm… could be a use case for this: http://datamanipulation.net/tsqlmacro/ Thu, 11 Feb 2010 01:49:09 http://twitter.com/AdamMachanic/statuses/8930204248
SQLvariant: @AdamMachanic Are you suggesting the TSQLMacro for rebuilding the queries or something? Thu, 11 Feb 2010 01:50:48 http://twitter.com/SQLvariant/statuses/8930274857
AdamMachanic: @SQLvariant But are they filtered for something like “last quarter” or something more static? I’m not saying filtered indexes are bad, 1/2 Thu, 11 Feb 2010 01:51:12 http://twitter.com/AdamMachanic/statuses/8930292580
AdamMachanic: @SQLvariant but rather that it’s dangerous and tricky to properly filter on a moving target 2/2 Thu, 11 Feb 2010 01:51:32 http://twitter.com/AdamMachanic/statuses/8930307008
AdamMachanic: @SQLvariant Right, you could create a macro for the dynamic predicate, then just re-process all of your procs along w/ the queries Thu, 11 Feb 2010 01:51:59 http://twitter.com/AdamMachanic/statuses/8930325441
AdamMachanic: @SQLvariant As a matter of fact, I’m about to release a new version of the framework, and this could be interesting to add to the docs! Thu, 11 Feb 2010 01:52:30 http://twitter.com/AdamMachanic/statuses/8930348061
SQLvariant: @AdamMachanic I have a very static use pattern for records in the last 90 days; after that, they don’t get queried as much. Thu, 11 Feb 2010 01:53:18 http://twitter.com/SQLvariant/statuses/8930382479
SQLvariant: @AdamMachanic Oh. Well I was just going to do it with PowerShell. We have a TSQL query that rebuilds them now (a bit manual though). Thu, 11 Feb 2010 01:54:46 http://twitter.com/SQLvariant/statuses/8930445413
AdamMachanic: @SQLvariant That rebuilds queries? You’re already doing that work? Thu, 11 Feb 2010 01:55:34 http://twitter.com/AdamMachanic/statuses/8930479667
SQLvariant: @AdamMachanic … Sorry, re-phrase: We already have a TSQL Query that rebuilds other things based on current month. Thu, 11 Feb 2010 01:55:36 http://twitter.com/SQLvariant/statuses/8930481170
AdamMachanic: @SQLvariant So what are you doing now? Maintaining a separate table for the previous 90 days worth of data? Thu, 11 Feb 2010 01:56:27 http://twitter.com/AdamMachanic/statuses/8930517242
SQLvariant: @AdamMachanic um, kinda-sorta. But it’s for the B/I system, not for the relational system. Thu, 11 Feb 2010 01:57:55 http://twitter.com/SQLvariant/statuses/8930578819
AdamMachanic: @SQLvariant Seems like partitioning (as you mentioned yesterday) would be the easiest solution for the case you mentioned… if you have 1/2 Thu, 11 Feb 2010 02:00:06 http://twitter.com/AdamMachanic/statuses/8940513547
SQLvariant: @AdamMachanic I was already working on replacing that semi-automatic T-SQL process with a fully-automatic PowerShell script. Thu, 11 Feb 2010 02:00:22 http://twitter.com/SQLvariant/statuses/8940528365
AdamMachanic: @SQLvariant less than 20 years worth of data, you could even partition by week and it would be dead simple to maintain 2/2 Thu, 11 Feb 2010 02:00:25 http://twitter.com/AdamMachanic/statuses/8940530606
SQLvariant: @AdamMachanic Right. Because I can create indexes that are only on certain partitions right? Thu, 11 Feb 2010 02:01:46 http://twitter.com/SQLvariant/statuses/8940593964
AdamMachanic: @SQLvariant I don’t believe so, but you can put partitions on whatever filegroup you want and easily move them around at will, so if you 1/2 Thu, 11 Feb 2010 02:02:35 http://twitter.com/AdamMachanic/statuses/8940630194
AdamMachanic: @SQLvariant had one partition per week you could slide the new week onto the flash drives and the old week off in two lines of code 2/2 Thu, 11 Feb 2010 02:03:01 http://twitter.com/AdamMachanic/statuses/8940648133
SQLvariant: @AdamMachanic Sorry, must be mixing SSAS aggregations. But I dont want to even backup the full indexes since I won’t really need all of them Thu, 11 Feb 2010 02:06:24 http://twitter.com/SQLvariant/statuses/8940794933
AdamMachanic: @SQLvariant No one will ever ask for old data? Or you just don’t care if the old data query takes 100x longer? Thu, 11 Feb 2010 02:07:24 http://twitter.com/AdamMachanic/statuses/8940839200
SQLvariant: @AdamMachanic … I know what you’re going to say: File Group level backup. Thu, 11 Feb 2010 02:07:51 http://twitter.com/SQLvariant/statuses/8940859327
AdamMachanic: @SQLvariant Wrong, I wouldn’t say that. Because I barely ever deal with backups and it wouldn’t occur to me :-) Thu, 11 Feb 2010 02:08:35 http://twitter.com/AdamMachanic/statuses/8940891847
SQLvariant: @AdamMachanic more like noone does same type of range searches after 3 months.If they’re looking for an 18 month old record they know the id Thu, 11 Feb 2010 02:10:17 http://twitter.com/SQLvariant/statuses/8940966189
AdamMachanic: @SQLvariant Hmm, that might change things–you wouldn’t necessarily have to bear the query maintenance nightmare. What if, instead of 1/2 Thu, 11 Feb 2010 02:13:55 http://twitter.com/AdamMachanic/statuses/8941122014
SQLvariant: @AdamMachanic lets put it this way, I don’t care if ‘old-record’ queries take 100x longer because they are out-numbered 12,000:1 by ‘new’ Thu, 11 Feb 2010 02:14:31 http://twitter.com/SQLvariant/statuses/8941147347
AdamMachanic: @SQLvariant filtering on the date col, you create a BIT col, IsInLast90Days, and update it nightly? Then filter your index on that? And 2/3 Thu, 11 Feb 2010 02:14:34 http://twitter.com/AdamMachanic/statuses/8941149460
AdamMachanic: @SQLvariant use that column in the WHERE clause in all of the range queries 3/3 Thu, 11 Feb 2010 02:14:50 http://twitter.com/AdamMachanic/statuses/8941160597
SQLvariant: @AdamMachanic oh, so what I was thinking was filter on last 90 days, then INCLUDE like 6 additional columns. Can I do that? Thu, 11 Feb 2010 02:15:50 http://twitter.com/SQLvariant/statuses/8941204408
AdamMachanic: @SQLvariant Yes, you can have included columns in a filtered index Thu, 11 Feb 2010 02:16:46 http://twitter.com/AdamMachanic/statuses/8941244702
AdamMachanic: @SQLvariant the important thing is you can’t filter on “last 90 days” — you have to include an actual date. That’s why I suggested BIT col Thu, 11 Feb 2010 02:18:32 http://twitter.com/AdamMachanic/statuses/8941317917
AdamMachanic: @SQLvariant Then it becomes 100% data-driven and you don’t have to change any indexes or queries to keep it working Thu, 11 Feb 2010 02:19:02 http://twitter.com/AdamMachanic/statuses/8941338868
SQLvariant: @AdamMachanic ok. Well doing the bit column would make the filtered indexes even smaller too. I like your solution . Thu, 11 Feb 2010 02:19:22 http://twitter.com/SQLvariant/statuses/8941352821
AdamMachanic: @SQLvariant I think I’ll do a blog post on this :-) … thanks for the interesting discussion Thu, 11 Feb 2010 02:20:07 http://twitter.com/AdamMachanic/statuses/8941384877
SQLvariant: @AdamMachanic I would just have to do heavy re-indexing on the weekends right? Oh no wait, I don’t!! because they’re on SSD drives :-D Thu, 11 Feb 2010 02:21:33 http://twitter.com/SQLvariant/statuses/8941449444
SQLvariant: @AdamMachanic Awesome. I think we may have solved more problems than we currently realize. please remember to mention me :-) Thu, 11 Feb 2010 02:25:00 http://twitter.com/SQLvariant/statuses/8941594839
SQLvariant: @AdamMachanic Hey maybe we could do this again next week and you could help me solve some of my XML dilemmas :-D Thu, 11 Feb 2010 02:42:36 http://twitter.com/SQLvariant/statuses/8942342844
AdamMachanic: @SQLvariant Sure thing! XML is something I love to hate… Thu, 11 Feb 2010 03:12:23 http://twitter.com/AdamMachanic/statuses/8943583606

Lunch-n-Learn #01: SQL Server 2005 Features

Yesterday I did a quick Lunch-n-Learn here at my company on a few SQL Server 2005 features and this post is just a follow-up to remind everyone what we saw and where you can find those features.  I will try to still make this useful for those of you who didn’t attend.

0:  To make any of these code examples work please download and install the Sample Databases for SQL Server.  (Don’t worry, they’re pretty small.)

  1. The first thing that you folks saw was the intelli-sense where as I was typing the name of a table and SQL Server Management Studio (SSMS) was finishing the table name for me.  That was the only SQL Server 2008 exclusive feature that you saw in the entire session.  You can only see this if you have the SSMS 2008 client pointed to a SQL 2008 db.
  2. I showed you guys how to find out the name of every table and column of the db that you are in using the system views:
    SELECT *
    FROM INFORMATION_SCHEMA.TABLES
  3. SELECT *
    FROM INFORMATION_SCHEMA.COLUMNS

  4. Ticks!  How did this apostrophe get into our db?  And how do we get it out?
    SELECT  [Comments] ,[ProductReviewID] ,[ProductID] ,[ReviewerName] ,[ReviewDate] ,[EmailAddress] ,[Rating] ,[ModifiedDate]
      FROM [AdventureWorks].[Production].[ProductReview]
  5. Well you just use 2 ticks to insert a single tick.  Said again, you use “’’” to insert “” into SQL. Here’s an example from the AdventureWorks database:
    SET IDENTITY_INSERT [Production].[ProductReview] ON
    INSERT [Production].[ProductReview] ([ProductReviewID], [ProductID], [ReviewerName], [ReviewDate], [EmailAddress], [Rating], [Comments], [ModifiedDate])
    VALUES
    (6, 709, ‘John Smith’, CAST(0×0000941800000000 AS DateTime), “>‘john@fourthcoffee.com’, 5
    , ‘I can”t believe I”m singing the praises of a pair of socks, but I just came back from a grueling
    3-day ride and these socks really helped make the trip a blast. They”re lightweight yet really cushioned my feet all day.
    The reinforced toe is nearly bullet-proof and I didn”t experience any problems with rubbing or blisters like I have with
    other brands. I know it sounds silly, but it”s always the little stuff (like comfortable feet) that makes or breaks a long trip.
    I won”t go on another trip without them!’
    , CAST(0×0000941800000000 AS DateTime))
    SET IDENTITY_INSERT [Production].[ProductReview] OFF

    And we can get it out like this:
    UPDATE [Production].[ProductReview]
       SET Comments = REPLACE(Comments, ””, )
     WHERE ProductReviewID = 6

  6. To make your keyboard as useful as mine what you do is open up SSMS click on Tool > Options > Environment > Keyboard >and add the commands that you would like the corresponding shortcut key to execute.
    image
  7. What Exactly is XACT_ABORT?  When XACT_ABORT is ON SQL Server will stop and roll back the transaction as soon as it hits an error; it won’t continue processing all the way to the end.  “When SET XACT_ABORT is OFF, in some cases only the Transact-SQL statement that raised the error is rolled back and the transaction continues processing.”
    Use this script to see it work for yourself.
  8. The next feature that I showed you was how you can create an Identity Column for the data you are  selecting without having to insert the data into a table by using the ROW_NUMBER() function.  I mentioned several other features along with that one and I will demo those features in our next Lunch-n-Learn.  In the meantime here’s a script that will show you it do 4 different row numbers on 4 different fields all at the same time.
    /* SQL Purists: please don’t freak out at this script, I’m just showing functionality*/
    SELECT TOP 500 *
                 ROW_NUMBER
    () OVER (ORDER BY AvgCPUTime DESC) AS 'AVG Time Rank'
          
    ,     ROW_NUMBER() OVER (ORDER BY total_cpu_time DESC) AS 'Total CPU Rank'
          
    ,     ROW_NUMBER() OVER (ORDER BY total_duration_time DESC) AS 'Total Duration Rank'
          
    ,     ROW_NUMBER() OVER (ORDER BY total_execution_count DESC) AS 'Total Executions Rank'
          
    , a.TEXT AS 'StatementText'
          
    , a.total_cpu_time
          
    , a.total_execution_count
          
    , a.total_duration_time
          
    , a.AvgCPUTime
          
    , a.number_of_statements
          
    , a.plan_handle
          
    , SUBSTRING(a.TEXT, 1, 100) AS 'hundy', a.name
      
    FROM (
          
    SELECT
                
    sql_text.TEXT,
              
    SUM(qs.total_worker_time) AS total_cpu_time,�
              
    SUM(qs.total_elapsed_time) AS total_duration_time,�
              
    SUM(qs.execution_count) AS total_execution_count,
              
    SUM(qs.total_worker_time) / SUM(qs.execution_count) AS AvgCPUTime,
              
    COUNT(*) AS  number_of_statements,�
              
    qs.plan_handle , db.name
          
    FROM�
              
    sys.dm_exec_query_stats qs
              
    CROSS apply sys.dm_exec_sql_text(sql_handle) AS sql_text
          
    LEFT OUTER JOIN sys.databases db
            
    ON sql_text.dbid = db.database_id
          
    --WHERE dbid = 10
          
    GROUP BY sql_text.TEXT,
          
    qs.plan_handle , db.name
    )a
    ORDER BY AvgCPUTime DESC
  9. Comparing which way is better.  To compare how long and how much data was needed to satisfy two different queries you can just click on the Include Client Statistics button before you run the first query and it will start capturing the statistics for you:
    image
  10. And finally the built-in reports.  To run any of them just Right-Click any database in SSMS Object Explorer and navigate to the report that you want:

That pretty much wraps it up for what we covered yesterday.  I will put some examples together for the Common Table Expressions (CTE), RANK, DENSE_RANK, and NTILE fuctions that I mentioned yesterday so that we can go over them at the next one.  Next Tuesday work good for you?  :-)
If you would like anything else covered you can just email me or comment here.

T-SQL Tuesday #002 A Puzzling Situation: Max Server Memory

Today’s post about changing your Max Server Memory setting is to answer the call from Adam Machanic about Puzzling Situations .

A couple weeks before I headed out to the 2009 PASS Summit I encountered a puzzler of my own. One of our servers issued an alert that it had an extremely low Page Life Expectancy (PLE); like 16. All of the databases on this server had recently migrated from an older 32 bit server with 4 GB of RAM to thier current 64 bit server with 8 GB of RAM. As luck would have it, this was the source of my puzzling situation. When we migrated the dbs we inadvertantly transfered the memory configuration used in their old 32 bit server home. Who made this classic rookie error?? Yours truly. I was doing two server migrations at once and bobbled the checklists.

I rectified the situation by increasing the RAM settings from 3 GB to 6 GB:

sp_configure 'max server memory (MB)', '6144'
RECONFIGURE

MaxRAMBefore

Want to guess what happened when I ran the RECONFIGURE command?

I watched as the perfmon counters immediately went down! Indicating that memory usage had dropped rather than increased.

MaxRAMAfter

As it turns out in SQL Server 2005 (and in SQL Server 2008 as far as I know) when you run RECONFIGURE for anything you dump the procedure cache. So for example if you were to change the setting for ‘”Web Assistant Procedures” you would dump the procedure cache. If you were to change the setting for “fill factor (%)” you would dump the procedure cache.

So beware before you change a configuration setting in your Production environment and run RECONFIGURE.

So there’s my Puzzling Situations for T-SQL Tuesday #002

T-SQL Tuesday Date, Time, tricks with the DateTime Data Type

Adam Machanic told us all about a new craze sweeping the SQL Blogosphere Nation last week and that is T-SQL Tuesdays. Real quick, the way it works is that on Patch-Tuesday everyone who’s got something to say about the topic of the month releases a blog post about it and the “Host” of the topic recaps all of the various blog posts in a blog at their site. OK now onto the topic.

Because I think there might be a few people bolgging about this today I will keep min short-and-sweet and go over 5 main points of the Old-School DateTime data type.

Before I start I want to remind you that DBAs Data Professionals are a little different, a lot of us think in terms of Largest to Smallest unit when we think of DateTime; which makes it into the way that you think of a standard number. Right now it is “200912051505” or “2009-12-05 15:05”

Selecting and aggregating using Styles all of the rows in a table can be a little problematic if you are selecting a date that looks something like this one “2009-12-05 15:05”. One of my favorite ways to get around this is with the CONVERT function and changing it to a VARCHAR and then using a style. Here’s what I usually do.

Run this query in AdventureWorks and you’ll notice that it also pulls in time which might be something that we want to avoid:

SELECT COUNT(*) AS '# of Orders'
 , OrderDate AS 'Order Date'
  FROM Sales.SalesOrderHeader
 GROUP BY OrderDate
 ORDER BY OrderDate
# of Orders Order Date
32 2008-07-28 00:00:00.000
31 2008-07-29 00:00:00.000
23 2008-07-30 00:00:00.000
40 2008-07-31 00:00:00.000

So what I do is CONVERT it to VARCHAR and then add Style 112 to it

SELECT COUNT(*) AS '# of Orders'
 , CONVERT(VARCHAR, OrderDate, 112) AS 'Order Date'
  FROM Sales.SalesOrderHeader
 GROUP BY CONVERT(VARCHAR, OrderDate, 112)
 ORDER BY CONVERT(VARCHAR, OrderDate, 112)
# of Orders Order Date
32 20080728
31 20080729
23 20080730
40 20080731

Now this isn’t overly readable but it sorts great. Another problem with it is that it doesn’t paste into Excel real well. For pasting into Excel and having it quickly recognize it as a DateTime field I use Style 110 but there’s a catch. Style 110 pastes into Excel fine but it doesn’t sort properly so I end up having to keep my Style 112 column so that I can sort on it.

SELECT COUNT(*) AS '# of Orders'
  , CONVERT(VARCHAR, OrderDate, 110) AS 'Order Date'
  , CONVERT(VARCHAR, OrderDate, 112) AS 'Order Sort'
  FROM Sales.SalesOrderHeader
 GROUP BY CONVERT(VARCHAR, OrderDate, 110)
  , CONVERT(VARCHAR, OrderDate, 112)
 ORDER BY CONVERT(VARCHAR, OrderDate, 112)
# of Orders Order Date
32 7/28/2008
31 7/29/2008
23 7/30/2008
40 7/31/2008

Selecting just the time with Style 108 is another trick I have used in the past. As a quick and easy way to extract just the time out of a DateTime field is to CONVERT it to VARCHAR making sure to specify a length of 5. (Now if you also want the seconds you need to make the length 8.)

SELECT GETDATE() AS 'GetDate', CONVERT(VARCHAR(5)
 , GETDATE(), 108) AS 'GetTime'
GetDate GetTime
2009-12-05 17:10:54.430 17:10

And now for my final trick
Selecting the date of the Sunday of the Week (or any recurring day of the week)

Sometimes – especially in Business Intelligence – you want to group data by week but you don’t want to use DATEPART (WK, OrderDate) because that produces a number and you might want something more like an actual date. In this case what I typically do is just use this: DATEADD(DAY, 1-DATEPART(WEEKDAY, OrderDate), OrderDate)
(Now you can pick the Saturday of that week just as easily by swapping out that 1 for a 7.)

SELECT COUNT(*) AS '# of Orders'
 , DATEPART (WK, OrderDate)
 , DATEADD(DAY, 1-DATEPART(WEEKDAY, OrderDate), OrderDate) AS 'Sunday of the Week'
 , DATEPART(WEEKDAY, OrderDate) AS 'Day# of Week'
 , CONVERT(VARCHAR, OrderDate, 112) AS 'Order Date'
  FROM Sales.SalesOrderHeader
 GROUP BY DATEPART (WK, OrderDate)
 , CONVERT(VARCHAR, OrderDate, 112)
 , DATEADD(DAY, 1-DATEPART(WEEKDAY, OrderDate), OrderDate)
 , DATEPART(WEEKDAY, OrderDate)
 ORDER BY CONVERT(VARCHAR, OrderDate, 112)
# of Orders Sunday of the Week Day# of Week Order Date
24 2008-07-20 00:00:00.000 6 20080725
32 2008-07-20 00:00:00.000 7 20080726
29 2008-07-27 00:00:00.000 1 20080727
32 2008-07-27 00:00:00.000 2 20080728
31 2008-07-27 00:00:00.000 3 20080729
23 2008-07-27 00:00:00.000 4 20080730
40 2008-07-27 00:00:00.000 5 20080731

You can check out the rest of the blogs for this T-SQL Tuesday topic right here: http://sqlblog.com/blogs/adam_machanic/archive/2009/12/09/t-sql-tuesday-001-the-roundup.aspx or do a search on Twitter and look for the hash #TSQL2sDay.
I hope this helps a few people out, as always if you have any questions please comment.
TSQL2sDay

Using PowerShell to Archive Twitter Feeds–Preserving the wisdom of Paul Randal

If you didn’t make it out to the PASS Summit then you missed out on a lot of great content.  If you’re not on twitter and following some of SQL Server’s best and or rowdiest than you’re missing a lot.  And if you didn’t follow Paul Randal while he was tweeting from the session he and Kimberly L. Tripp presented then you missed a great refersher course on SQL fundamentals that are critical to your success in this field.

The challenge of dealing with great content burried in tweets is figuring out how to capture that information in a way you can reference it later. I took a queue from of Bruce Payette’s book Windows PowerShell in Action and decided I’d try tackling this problem. 

I started by visiting the PaulRandal twitter page. If you just wanted to download his last 20 tweets you could just use the RSS feed: http://twitter.com/statuses/user_timeline/36394357.rss .  How do you get the others? I got around the 20 tweet limitation by  favorite-ing Paul’s tweets starting at the beginning of the conference and then working my way toward the current date:

Every time I selected 20 of Paul’s tweets as a favorite I just ran this PowerShell script and appended it to a file that I was storing them in. 

 ([xml] (new-object net.webclient).DownloadString(http://twitter.com/favorites/76699854.rss”)).rss.channel.item | format-table -autosize description, pubDate, link >> PaulRandal.txt

After that I used SSIS to load them in a SQL db and help me clear out a few of the tweets that would be of little use without the other half of the conversation and what not. 

I did learn a couple of interesting PowerShell quirks during this process.  The first is that your output is truncated based on your available screen size.  I began writing this script while running the PowerShell command in a 1280 x 1024 screen.  When my output was restricted I took a chance and tried running it on my laptop where the resolution is ste to 1920 x 1200. Running the download at a higher resolution was good enough to solve problem. (I haven’t yet found out why PowerShell kept trying to truncate in the first place. If you have ideas on this feel free to use the comments.)  The second was seeing the real differenece between the “>>”  and “>” operators.  By using a double “>>” instead of a single “>” I was able to append my output instead of completely replace it every time I ran my script.  Next time I’ll figure out how to pump it straight into a table so that I can skip the SSIS step.

Finally here’s what I ended up with:

Handle Tweet TweetDate TweetLink HashTags
PaulRandal: And we’re on – pretty packed room here in our pre-con – just shy of 100. #sqlpass                 11/2/09 4:38 PM http://twitter.com/PaulRandal/statuses/5366919942 #sqlpass                
PaulRandal: #sqlpass Let’s make the hashtag for our indexing precon #ktprecon – I’ll watch both.                11/2/09 4:56 PM http://twitter.com/PaulRandal/statuses/5367318129 #sqlpass  #ktprecon 
PaulRandal: Question from #sqlpass: Ever a use for heaps? A: Not really. E.g. incoming clickstream temp storage             11/2/09 4:58 PM http://twitter.com/PaulRandal/statuses/5367371468 #sqlpass: 
PaulRandal: #sqlpass Either that or Kimberly’s jokes really *are* bad, and I’m just laughing because I have to (being married to her) :-)       11/2/09 5:01 PM http://twitter.com/PaulRandal/statuses/5367439309 #sqlpass 
PaulRandal: #ktprecon #sqlpass Q: why do SELECT COUNT(*) of a heap with fwded records generate extra IOs?              11/2/09 5:14 PM http://twitter.com/PaulRandal/statuses/5367732804 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass A: because the Storage Engine will only process fwded records when it finds them from a fwding record       11/2/09 5:14 PM http://twitter.com/PaulRandal/statuses/5367744740 #ktprecon  #sqlpass 
PaulRandal: @DBA_hole #ktprecon #sqlpass Yes (unless you specifically ask for a nonclustered primary key)              11/2/09 5:19 PM http://twitter.com/PaulRandal/statuses/5367850801 #ktprecon  #ktprecon 
PaulRandal: @DBA_hole #ktprecon #sqlpass But not a drop/recreate. It’s a create of clustered index + drop of heap. Semantic, but important difference.   11/2/09 5:20 PM http://twitter.com/PaulRandal/statuses/5367869544 #ktprecon  #ktprecon 
PaulRandal: #ktprecon #sqlpass Our wonderful attendees… http://pic.gd/b17455                     11/2/09 5:24 PM http://twitter.com/PaulRandal/statuses/5367969054 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Kimberly in mid-sentence… isn’t she cute? :-) http://pic.gd/ba2662                11/2/09 5:26 PM http://twitter.com/PaulRandal/statuses/5368012672 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Ola Hallengren’s *wonderful* db maintenance script: http://bit.ly/3R5OUv               11/2/09 5:35 PM http://twitter.com/PaulRandal/statuses/5368219637 #ktprecon  #sqlpass 
PaulRandal: @sqlinsaneo They’re not real seagulls – they’re MS-controlled robots #sqlpass                  11/2/09 5:37 PM http://twitter.com/PaulRandal/statuses/5368256080 #sqlpass                 
PaulRandal: @buckwoody I’m trying to avoid looking at you – too embarrassed after what happened to us last night in that phone booth #sqlpass     11/2/09 5:42 PM http://twitter.com/PaulRandal/statuses/5368367982 #sqlpass    
PaulRandal: #ktprecon #sqlpass Alternative to shrink: http://bit.ly/43PQI                      11/2/09 5:54 PM http://twitter.com/PaulRandal/statuses/5368638484 #ktprecon  #sqlpass 
PaulRandal: @DBA_hole #ktprecon #sqlpass Depends on your I/O subsystem, filegroup layout, HA/DR strategy… may be more mgmt probs than gains     11/2/09 6:04 PM http://twitter.com/PaulRandal/statuses/5368853068 #ktprecon  #ktprecon 
PaulRandal: #sqlpass Please refill the coffee in the speaker room (and have someone check regularly…) thanks!             11/2/09 6:38 PM http://twitter.com/PaulRandal/statuses/5369614171 #sqlpass 
PaulRandal: @DonKirkham #sqlpass backup/restore does not reclaim space (or do anything else to the db). Only way to reclaim is some form of shrink.    11/2/09 6:41 PM http://twitter.com/PaulRandal/statuses/5369662274 #sqlpass 
PaulRandal: @DonKirkham See http://bit.ly/43PQI for an alternative for you.                      11/2/09 6:51 PM http://twitter.com/PaulRandal/statuses/5369891151 NULL
PaulRandal: @ktegels Because an existing filegroup has data files – a FS filegroup is a pointer to the root of the NTFS data container       11/2/09 6:52 PM http://twitter.com/PaulRandal/statuses/5369909736 NULL
PaulRandal: #ktprecon #sqlpass How expensive are page splits in terms of transaction log? http://bit.ly/MqUgU             11/2/09 7:03 PM http://twitter.com/PaulRandal/statuses/5370157274 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Do page splits ever roll back? No: script to prove it: http://bit.ly/2IgMM3              11/2/09 7:04 PM http://twitter.com/PaulRandal/statuses/5370177946 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Demo scripts (and companion content for the internals book chapter) are at http://bit.ly/42zJ4c         11/2/09 7:10 PM http://twitter.com/PaulRandal/statuses/5370304102 #ktprecon  #sqlpass 
PaulRandal: Audience perspective: RT @joewebb: Live from #ktprecon at #sqlpass.  http://twitpic.com/o13um              11/2/09 7:12 PM http://twitter.com/PaulRandal/statuses/5370346695 #ktprecon  #sqlpass
PaulRandal: #ktprecon #sqlpass Kimberly dissing DBCC commands while I’m on stage next to her? Not a smart move! :-)             11/2/09 7:17 PM http://twitter.com/PaulRandal/statuses/5370471853 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass OH from Kimberly: “The key points are…. really just the key points.” Very astute observation there dear :-)      11/2/09 7:45 PM http://twitter.com/PaulRandal/statuses/5371086548 #ktprecon  #sqlpass 
PaulRandal: @ChiragRoy #ktprecon #sqlpass It depends :-) Wait until she talks about indexing strategies this afternoon.           11/2/09 7:48 PM http://twitter.com/PaulRandal/statuses/5371143932 #ktprecon   
PaulRandal: @AndyLeonard #sqlpass #ktprecon She’ll never see it – she doesn’t tweet much – I’m safe :-)                11/2/09 7:49 PM http://twitter.com/PaulRandal/statuses/5371159601 #sqlpass  #ktprecon 
PaulRandal: #sqlpass People.. the answer is always “it depends”. Apart from if the question is ‘should auto-shrink be turned on?’.        11/2/09 7:58 PM http://twitter.com/PaulRandal/statuses/5371365926 #sqlpass 
PaulRandal: @datachick My other favorite answer is “12″ and then watch the mystified expressions. #sqlpass              11/2/09 8:01 PM http://twitter.com/PaulRandal/statuses/5371421542 #sqlpass             
PaulRandal: #sqlpass L U N C H    T I M E! #ktprecon We’ll be back to cover more incredible indexing info (and on-stage (verbal) spousal abuse! :-)     11/2/09 8:03 PM http://twitter.com/PaulRandal/statuses/5371476694 #sqlpass  #ktprecon 
PaulRandal: @DonKirkham Ah – no solution for that – maybe a 3rd-party backup/restore tool?                  11/2/09 8:52 PM http://twitter.com/PaulRandal/statuses/5372567849 NULL
PaulRandal: #ktprecon #sqlpass Once more into the breach, dear friends, once more….  back after lunch with the KT Indexing Show        11/2/09 9:05 PM http://twitter.com/PaulRandal/statuses/5372866600 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Don’t INCLUDE LOB columns in NC indexes. It creates a whole extra copy of the LOB data. Not good.        11/2/09 9:10 PM http://twitter.com/PaulRandal/statuses/5372989895 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass And don’t put an index on every column. One of the worst things you can do.              11/2/09 9:13 PM http://twitter.com/PaulRandal/statuses/5373037864 #ktprecon  #sqlpass 
PaulRandal: @SQLCraftsman Oh yeah. Confusing unto and into always gets me into unto-ward trouble.                11/2/09 9:16 PM http://twitter.com/PaulRandal/statuses/5373123933 NULL
PaulRandal: #ktprecon #sqlpass What is a ‘seekable’ index? An index with keys that can be used in a left-based subset to match a search argument.    11/2/09 9:23 PM http://twitter.com/PaulRandal/statuses/5373277154 #ktprecon  #sqlpass 
PaulRandal: #ktprecon @sqlpass What order should the NC index key columns be in? It depends… :-)                 11/2/09 9:24 PM http://twitter.com/PaulRandal/statuses/5373306090 #ktprecon 
PaulRandal: #ktprecon #sqlpass So far Kimberly’s answered “It depends” 15 times…                    11/2/09 9:26 PM http://twitter.com/PaulRandal/statuses/5373359667 #ktprecon  #sqlpass 
PaulRandal: #sqlpass Q I get asked: query perf dropping, what happened? If it slowly drops, fragmentation. If it drops off a cliff, stats. Commonly.   11/2/09 9:35 PM http://twitter.com/PaulRandal/statuses/5373562535 #sqlpass 
PaulRandal: @ChiragRoy #ktprecon #sqlpass Parts of database must all be at the same point in time as primary filegroup… no problem.       11/2/09 10:08 PM http://twitter.com/PaulRandal/statuses/5374338657 #ktprecon   
PaulRandal: #sqlpass Q: How to make system gen’d stats persist after a restart? A: they are always persisted in the primary FG.         11/2/09 10:10 PM http://twitter.com/PaulRandal/statuses/5374383621 #sqlpass 
PaulRandal: #ktprecon #sqlpass How are auto-gen’d stats names generated? http://bit.ly/14nc0w                 11/2/09 10:18 PM http://twitter.com/PaulRandal/statuses/5374593689 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Stats are *always* at the table level. Partitioning has *no* benefit as far as stats are concerned. Even in SS2008.    11/2/09 10:53 PM http://twitter.com/PaulRandal/statuses/5375430211 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass 2008 filtered stats != poor-man’s partition-level stats                   11/2/09 10:54 PM http://twitter.com/PaulRandal/statuses/5375440275 #ktprecon  #sqlpass 
PaulRandal: Apparently my #sqlpass worth today is limited to tweeting from #ktprecon, and holding her used teabags. Very humbling :-)        11/2/09 11:05 PM http://twitter.com/PaulRandal/statuses/5375710177 #sqlpass  #ktprecon
PaulRandal: @plitwin #sqlpass #ktprecon :-) She’ll get the same treatment in my Friday post-con – it goes both ways.           11/2/09 11:09 PM http://twitter.com/PaulRandal/statuses/5375810255 #sqlpass  #sqlpass 
PaulRandal: #ktprecon #sqlpass Filtered indexes and filtered stats might become seriously out-of-date http://bit.ly/1knEE2          11/2/09 11:41 PM http://twitter.com/PaulRandal/statuses/5376600563 #ktprecon  #sqlpass 
PaulRandal: #sqlpass One of the joys of co-presenting is watching Kimberly trying to draw on-screen using ZoomIt :-)            11/2/09 11:49 PM http://twitter.com/PaulRandal/statuses/5376778832 #sqlpass 
PaulRandal: #ktprecon #sqlpass Does order of columns in WHERE clause affect index choice? No. (unless you’ve got, say, 50 conditions)       11/2/09 11:50 PM http://twitter.com/PaulRandal/statuses/5376814447 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass I love hearing UNION described as “set, set squish”                    11/3/09 12:10 AM http://twitter.com/PaulRandal/statuses/5377285038 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Over-indexing is worse than under-indexing. Err on the side of fewer indexes always.            11/3/09 12:16 AM http://twitter.com/PaulRandal/statuses/5377431451 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass OH: keep the search arguments in the WHERE clause and the join arguments in the FROM clause          11/3/09 12:18 AM http://twitter.com/PaulRandal/statuses/5377480586 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass For OLTP or OLTP/DSS combo, you want to try to cover the aggregate. INCLUDE the columns you’re aggregating.      11/3/09 12:22 AM http://twitter.com/PaulRandal/statuses/5377572922 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass and GROUP BY the key. E.g. SUM(sales) by customer                    11/3/09 12:22 AM http://twitter.com/PaulRandal/statuses/5377583436 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass key would be customer, INCLUDE would be sales. Otherwise an unordered aggregate needs to be done. Slooooooow.     11/3/09 12:23 AM http://twitter.com/PaulRandal/statuses/5377606311 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Indexed views whitepaper http://bit.ly/22lStl                     11/3/09 12:29 AM http://twitter.com/PaulRandal/statuses/5377739599 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Whitepaper comparing heaps and clustered indexes http://bit.ly/HPonN                11/3/09 12:30 AM http://twitter.com/PaulRandal/statuses/5377761144 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Database Tuning Advisor whitepaper http://bit.ly/2ykHEI                   11/3/09 12:32 AM http://twitter.com/PaulRandal/statuses/5377819794 #ktprecon  #sqlpass 
PaulRandal: #ktprecon #sqlpass Craig Freedman’s blog on index_operational_stats http://bit.ly/BVcIV                11/3/09 12:35 AM http://twitter.com/PaulRandal/statuses/5377897936 #ktprecon  #sqlpass 
PaulRandal: Today Kimberly and I are the embodiment of ‘it depends’. Catch us at lunchtime! #sqlpass               11/3/09 6:30 PM http://twitter.com/PaulRandal/statuses/5398059867 #sqlpass              
PaulRandal: That picture’s on my FB page too :-) RT @robboek: @BrentO just put up a very flattering picture of @PaulRandal #sqlpass        11/3/09 11:57 PM http://twitter.com/PaulRandal/statuses/5405773692 #sqlpass       
PaulRandal: @MidnightDBA #sqlpass 1000 is a number I made up when back at MS, but it only applies if the table is in memory. Otherwise, sure, defrag.   11/4/09 12:06 AM http://twitter.com/PaulRandal/statuses/5406019739 #sqlpass 
PaulRandal: #sqlpass Just like the <10% nothing, 10-30% defrag, 30%+ rebuild. I made those numbers up too as people wanted *some* guidance. YMMV.   11/4/09 12:10 AM http://twitter.com/PaulRandal/statuses/5406101235 #sqlpass 
PaulRandal: @GFritchey Hope you didn’t mind me commenting on the tweets coming from your session!                11/4/09 12:53 AM http://twitter.com/PaulRandal/statuses/5407198123 NULL
PaulRandal: @GFritchey :-) I always like to ‘fess up about the BOL numbers/guidance about defragging.               11/4/09 1:01 AM http://twitter.com/PaulRandal/statuses/5407384733 NULL
PaulRandal: @kbriankelley @SQLSarg #sqlpass Absolutely disagree for user DBs.                     11/4/09 2:08 AM http://twitter.com/PaulRandal/statuses/5409027866 #sqlpass 
PaulRandal: @SQLSarg @kbriankelley #sqlpass and for tempdb, start with #files = 1/4-1/2 #cores IF seeing page latch contention (not page IO latch)    11/4/09 2:09 AM http://twitter.com/PaulRandal/statuses/5409043381 #sqlpass
PaulRandal: @kbriankelley @SQLSarg #sqlpass see http://bit.ly/vNMLv                        11/4/09 2:09 AM http://twitter.com/PaulRandal/statuses/5409052369 #sqlpass 
PaulRandal: #sqlpass For me best thing about this PASS is mting all Tweeps I’ve gotten to know over last 6 mths. We have a *rocking* community!     11/4/09 3:47 AM http://twitter.com/PaulRandal/statuses/5411356916 #sqlpass 
PaulRandal: #sqlpass In a good way, of course. Well, maybe except @BrentO and @sqlrockstar…. ;-D                11/4/09 3:50 AM http://twitter.com/PaulRandal/statuses/5411421298 #sqlpass 
PaulRandal: Snotty in Seattle. Cold is kicking my butt again, offline now to veg in front of TV b4 Logging&Recovery spotlight at #sqlpass in the a.m.   11/4/09 3:55 AM http://twitter.com/PaulRandal/statuses/5411539260 #sqlpass 
PaulRandal: Wow – all the #Muppets videos have gone from YouTube (under litigation threat from WMG) – no more #Manamana! How sad :-(        11/4/09 4:04 AM http://twitter.com/PaulRandal/statuses/5411732262 #Muppets  #Manamana
PaulRandal: #sqlpass Understand Logging and Recovery? Completely? If not, come to my spotlight this morning at 10.15 in 2AB.         11/4/09 4:08 PM http://twitter.com/PaulRandal/statuses/5423467554 #sqlpass 
PaulRandal: @AndyLeonard @sqlagentman It’s called job security. Make up numbers while at MS, get paid to explain them once I leave. Simple! ;-D #sqlpass  11/4/09 4:09 PM http://twitter.com/PaulRandal/statuses/5423487218 #sqlpass 
PaulRandal: @AndyLeonard #sqlpass Don’t blame me – I didn’t make up the schedule!                                                                         11/4/09 4:13 PM http://twitter.com/PaulRandal/statuses/5423581653 #sqlpass 
PaulRandal: @buckwoody A kilt will be on show.                                                                                                            11/4/09 4:13 PM http://twitter.com/PaulRandal/statuses/5423588057 NULL
PaulRandal: Had great fun doing my logging/recovery session this morning. I’ve got some much deeper log internals blog posts lined up too. #sqlpass       11/4/09 10:56 PM http://twitter.com/PaulRandal/statuses/5433042824 #sqlpass 
PaulRandal: @way0utwest You may have a kilt, but you also have a pink cowboy hat. I worry about you Steve… #sqlpass                                     11/4/09 11:58 PM http://twitter.com/PaulRandal/statuses/5434603222 #sqlpass 
PaulRandal: Damn right! bwin have a rocking SQL setup. RT @aspiringgeek: DBCC should be done everyday. No, not @paulrandal, bwin’s VLDB’s DBA #sqlpass    11/4/09 11:59 PM http://twitter.com/PaulRandal/statuses/5434631011 #sqlpass 
PaulRandal: Helping Kimberly thread the wireless mic under her top #sqlpass #passawesomeness :-)                                                           11/5/09 12:22 AM http://twitter.com/PaulRandal/statuses/5435227503 #sqlpass  #passawesomeness 
PaulRandal: @SQLCraftsman Just ask @BuckWoody about the time he was almost arrested in Leavenworth with me…. #sqlpass                                   11/5/09 12:24 AM http://twitter.com/PaulRandal/statuses/5435267079 #sqlpass 
PaulRandal: In Kimberly’s Covering Indexes Spotlight session – 4C1-2 #sqlpass                                                                             11/5/09 12:28 AM http://twitter.com/PaulRandal/statuses/5435383697 #sqlpass 
PaulRandal: Kimberly on stage #sqlpass http://pic.gd/ad90dc                                                                                               11/5/09 12:35 AM http://twitter.com/PaulRandal/statuses/5435542229 #sqlpass 
PaulRandal: RT @sarahspace: How I explain what it is like to be a DBA:  DBA is the sexiest profession there is this side of being a stripper #sqlpass     11/5/09 12:45 AM http://twitter.com/PaulRandal/statuses/5435797449 #sqlpass 
PaulRandal: Now sitting next to @sqlfool in @kimberlyltripp’s session #sqlpass                                                                            11/5/09 12:46 AM http://twitter.com/PaulRandal/statuses/5435836985 #sqlpass 
PaulRandal: @kimberlyltripp’s Tipping Point blog posts r @ http://bit.ly/2yStzr #sqlpass You’d be amazed how selective a query must be to use an index.   11/5/09 12:50 AM http://twitter.com/PaulRandal/statuses/5435945322 #sqlpass 
PaulRandal: @t_burger @kimberlyltripp’s deck is up on site but may not have made it to the download section yet. Don’t worry, it will be. #sqlpass        11/5/09 12:54 AM http://twitter.com/PaulRandal/statuses/5436032143 #sqlpass 
PaulRandal: @DevSQL She also has roadrunnerkt and I have roadrunnerpr. I’ve got another one called roadkill :-) #sqlpass                                  11/5/09 12:55 AM http://twitter.com/PaulRandal/statuses/5436070845 #sqlpass 
PaulRandal: @tjaybelt I think @kimberlyltripp just rocks full-stop :-)                                                                                     11/5/09 1:00 AM http://twitter.com/PaulRandal/statuses/5436179324 NULL
PaulRandal: @aspiringgeek She’s sitting next to me – just showed her that tweet #sqlpass                  11/5/09 1:00 AM http://twitter.com/PaulRandal/statuses/5436195302 #sqlpass                 
PaulRandal: Latest version of @kimberlyltripp’s sp_helpindex2 script is at http://bit.ly/3WjfSJ #sqlpass              11/5/09 1:04 AM http://twitter.com/PaulRandal/statuses/5436286609 #sqlpass             
PaulRandal: He has amazing body-hair…. RT @janhonenj: #sqlpass @BuckWoody is claiming he knows something about shampoo. I’m not sure I believe him.   11/5/09 1:06 AM http://twitter.com/PaulRandal/statuses/5436336983 #sqlpass 
PaulRandal: @Kimberlyltripp managed to go 6 whole seconds without saying ‘it depends’ after challenging herself not to. Nice. #sqlpass       11/5/09 1:09 AM http://twitter.com/PaulRandal/statuses/5436412870 #sqlpass      
PaulRandal: Do not just automatically put an index on every column #sqlpass                      11/5/09 1:13 AM http://twitter.com/PaulRandal/statuses/5436521435 #sqlpass                     
PaulRandal: Over-indexing is usually worse than under-indexing – think of the overhead of maintaining all those unused indexes… #sqlpass      11/5/09 1:14 AM http://twitter.com/PaulRandal/statuses/5436540474 #sqlpass     
PaulRandal: Covering: best done cleverly, correctly, and concisely. @kimberlyltripp was in an alliterative mood, obviously. #sqlpass       11/5/09 1:16 AM http://twitter.com/PaulRandal/statuses/5436603907 #sqlpass      
PaulRandal: @BrentO, *you* of all people organized a breakfast *without* #bacon?!?! RT @lotsahelp: @BrentO going to remember the #bacon? #sqlpass    11/5/09 1:26 AM http://twitter.com/PaulRandal/statuses/5436850100 #bacon?!?!  #sqlpass
PaulRandal: Chugging down Hall’s cough sweets to try to avoid a cacophony of coughing in the covering session #sqlpass           11/5/09 1:27 AM http://twitter.com/PaulRandal/statuses/5436883380 #sqlpass          
PaulRandal: If your stats are out of date, it might not matter how good your indexes are – SQL may not be able to figure out to use them #sqlpass    11/5/09 1:30 AM http://twitter.com/PaulRandal/statuses/5436960619 #sqlpass   
PaulRandal: OH from @kimberlyltripp: I want you to stop caring #sqlpass                       11/5/09 1:40 AM http://twitter.com/PaulRandal/statuses/5437224158 #sqlpass                      
PaulRandal: You can get the Credit db that @kimberlyltripp was using in the session from http://bit.ly/1PHPKi #sqlpass           11/5/09 1:43 AM http://twitter.com/PaulRandal/statuses/5437302767 #sqlpass          
PaulRandal: OMG these chairs are incredibly uncomfortable – parts of my anatomy are asleep and sore! #sqlpass             11/5/09 1:45 AM http://twitter.com/PaulRandal/statuses/5437340876 #sqlpass            
PaulRandal: Using indexed views wps http://bit.ly/22lStl (2005) and http://bit.ly/3LpZnT (2008). Don’t go crazy with them though #sqlpass      11/5/09 1:58 AM http://twitter.com/PaulRandal/statuses/5437695804 #sqlpass     
PaulRandal: My latest TechNet Magazine article is out on web “Recovering from Disasters Using Backups” http://bit.ly/14XK1l #sql #sqlserver #sqlpass   11/5/09 4:35 PM http://twitter.com/PaulRandal/statuses/5453506227 #sql #sqlserver #sqlpass
PaulRandal: Yeah! RT @sqlbelle: Yup! Agreed! RT @kbriankelley: @sqlbelle That’s a shame. You’ll get more DR info out of a @PaulRandal session. #sqlpass   11/5/09 5:17 PM http://twitter.com/PaulRandal/statuses/5454526890 #sqlpass  
PaulRandal: We spent ton of time at end of 2005 dev reducing data/inst cache misses – very fiddly, gnarly work, but fun! #sqlpass                         11/5/09 5:44 PM http://twitter.com/PaulRandal/statuses/5455166160 #sqlpass 
PaulRandal: I always explain that the NULL bitmap in a record is one big cpu cache miss prevention mechanism #sqlpass                                     11/5/09 5:46 PM http://twitter.com/PaulRandal/statuses/5455200176 #sqlpass 
PaulRandal: Here’s the MIT paper, it’s a good read: Materialization Strategies in a Column-Oriented DBMS http://bit.ly/2q4Nu0 #sqlpass                    11/5/09 6:17 PM http://twitter.com/PaulRandal/statuses/5455915997 #sqlpass 
PaulRandal: You can actually download MITs column store database engine source code and play around with it too http://bit.ly/245xT6 #sqlpass             11/5/09 6:24 PM http://twitter.com/PaulRandal/statuses/5456076673 #sqlpass 
PaulRandal: Me too! RT @AndyLeonard: Hey #sqlpass! I will be at the PASS Bookstore at noon to sign books and answer questions.                            11/5/09 6:53 PM http://twitter.com/PaulRandal/statuses/5456739889 #sqlpass! 
PaulRandal: @sqlfool I’ll be wearing my ‘it depends’ t-shirt again today, just for you. See you at lunch at the bookstore.                                11/5/09 7:09 PM http://twitter.com/PaulRandal/statuses/5457110526 NULL
PaulRandal: Came home from #sqlpass to prep for tomorrow’s post-con/convalesce – lots of #bacon and eggs for lunch mmmmmmm                                11/5/09 9:34 PM http://twitter.com/PaulRandal/statuses/5460564441 #sqlpass  #bacon
PaulRandal: @aspiringgeek Surely they’re not advising that as a generalization? #sqlpass                                                                  11/5/09 10:02 PM http://twitter.com/PaulRandal/statuses/5461290973 #sqlpass 
PaulRandal: @simon_sabin Yup, -E makes ind creates/rebuilds alloc multiple extents when round-robin-ing. Didn’t realize @aspiringgeek’s context #sqlpass  11/5/09 10:08 PM http://twitter.com/PaulRandal/statuses/5461450239 #sqlpass 
PaulRandal: @hpebley3 #sql the database with the ID in the message is shutdown and can’t be started for some reason.                                      11/5/09 11:01 PM http://twitter.com/PaulRandal/statuses/5462793689 #sql 
PaulRandal: Leave it on for *all* DBs RT @sqlbelle: Leave autogrow on for #sharepoint dbs  . It is like your catastrophic insurance policy #SQLPASS       11/5/09 11:02 PM http://twitter.com/PaulRandal/statuses/5462805846 #sharepoint  #SQLPASS
PaulRandal: #sqlpass if anyone’s brave enough, ask @BuckWoody to tell the story of the time we were arrested in Leavenworth when he did a strip-tease…  11/5/09 11:06 PM http://twitter.com/PaulRandal/statuses/5462923584 #sqlpass 
PaulRandal: @PaulRandal #sqlpass … during the winter yodeling competition.                                                                              11/5/09 11:07 PM http://twitter.com/PaulRandal/statuses/5462941379 #sqlpass 
PaulRandal: #sqlpass And btw, @BuckWoody won the yodeling competition. Very scary. Never go on vacation with that man.                                    11/5/09 11:10 PM http://twitter.com/PaulRandal/statuses/5463008889 #sqlpass 
PaulRandal: @AndyLeonard Tell him “No, no, the other one – the burly one that grabbed me”                                                                 11/5/09 11:11 PM http://twitter.com/PaulRandal/statuses/5463038560 NULL
PaulRandal: #sqlpass Ok, ask @BuckWoody why he’s not allowed on any Sound Transit public buses any more… there’s a story.                               11/5/09 11:12 PM http://twitter.com/PaulRandal/statuses/5463065739 #sqlpass 
PaulRandal: #sqlpass When they arrested @BuckWoody, he tried to claim he was Bill Gates. But the cop knew Bill had more hair.                             11/5/09 11:13 PM http://twitter.com/PaulRandal/statuses/5463093029 #sqlpass 
PaulRandal: #sqlpass Twitter is wonderful, interacting with (well, derailing) sessions remotely! Maybe @BuckWoody and I should co-present one next time?  11/5/09 11:15 PM http://twitter.com/PaulRandal/statuses/5463145994 #sqlpass 
PaulRandal: @AndyLeonard @BuckWoody’s Kung Fu is weaker than mine… #sqlpass                                                                             11/5/09 11:17 PM http://twitter.com/PaulRandal/statuses/5463184554 #sqlpass 
PaulRandal: Hmm – he might ‘dress up’ again. RT @mrdenny: I think @PaulRandal and @buckwoody need to come to the bar with us tonight.  #sqlpass           11/5/09 11:19 PM http://twitter.com/PaulRandal/statuses/5463230998 #sqlpass 
PaulRandal: #sqlpass Someone tell @BuckWoody his wife called to say he’d forgotten his meds again this morning and could I take care of him?              11/5/09 11:24 PM http://twitter.com/PaulRandal/statuses/5463361106 #sqlpass 
PaulRandal: #sqlpass and whatever you do, don’t feed @BuckWoody’s psychoses by letting him talk to an audience – he gets delusions of grandeur.           11/5/09 11:25 PM http://twitter.com/PaulRandal/statuses/5463387065 #sqlpass 
PaulRandal: #sqlpass OMG – the gerbil story! (Well, multiple gerbils were involved actually) @BuckWoody’s daughter was really annoyed. Someone ask him..  11/5/09 11:27 PM http://twitter.com/PaulRandal/statuses/5463431830 #sqlpass 
PaulRandal: #sqlpass Just imagine @BuckWoody, dressed like a pest-control guy, tripping out on who-knows-what, running around a house after gerbils…    11/5/09 11:30 PM http://twitter.com/PaulRandal/statuses/5463505072 #sqlpass 
PaulRandal: @AaronBertrand That’s because of the Cease and Desist letter @BuckWoody had from the Animal Control folks #sqlpass                            11/5/09 11:32 PM http://twitter.com/PaulRandal/statuses/5463553322 #sqlpass 
PaulRandal: @AndyLeonard That reminds me – you should see tricks @BuckWoody can do with whole olives and cocktail sticks, using just his teeth #sqlpass   11/5/09 11:34 PM http://twitter.com/PaulRandal/statuses/5463602738 #sqlpass 
PaulRandal: That’s right. Never trust @BuckWoody. Never. RT @mrdenny: @AndyLeonard @PaulRandal I’m sure that it is a trick. #sqlpass                      11/5/09 11:35 PM http://twitter.com/PaulRandal/statuses/5463619541 #sqlpass 
PaulRandal: #sqlpass For finale, someone ask @BuckWoody if he can do last 5 minutes of his session after removing all his false teeth…he’s good at it!  11/5/09 11:37 PM http://twitter.com/PaulRandal/statuses/5463678735 #sqlpass 
PaulRandal: And you wonder why he gets arrested…. RT @SQLRockstar: @buckwoody has $5 in his pocket AND someone else’s pants on #woodyfacts #sqlpass     11/5/09 11:41 PM http://twitter.com/PaulRandal/statuses/5463773956 #woodyfacts  #sqlpass
PaulRandal: I’m proud I had most insults from @BuckWoody. I guess. RT @sqlagentman: New blog post: Buck Woody Has Issues http://bit.ly/3MSRpO #sqlpass    11/5/09 11:52 PM http://twitter.com/PaulRandal/statuses/5464044193 #sqlpass 
PaulRandal: @TimCaylor #sqlpass will be in Seattle Nov 8-11 2010                                                                                          11/5/09 11:52 PM http://twitter.com/PaulRandal/statuses/5464051949 #sqlpass 
PaulRandal: @BuckWoody and I just agreed to do a joint session next year – and we’ll both wear kilts! Be afraid… be very afraid…. #sqlpass            11/6/09 12:29 AM http://twitter.com/PaulRandal/statuses/5464941037 #sqlpass 
PaulRandal: #1 tip for speakers I saw this year at #sqlpass – get a clicker so you can move around the stage more freely.                                 11/6/09 12:31 AM http://twitter.com/PaulRandal/statuses/5464979616 #1  #sqlpass 
PaulRandal: Blog: http://bit.ly/14nc0w RT @GFritchey: WA in system stats stands for Washington state. From @Paulrandal via Gail Shaw. #sqlpass            11/6/09 12:35 AM http://twitter.com/PaulRandal/statuses/5465099051 #sqlpass 
PaulRandal: Err, Scotland? :-) RT @joewebb: where does one buy a kilt? #sqlpass                                                                           11/6/09 12:48 AM http://twitter.com/PaulRandal/statuses/5465408175 #sqlpass 
PaulRandal: @joewebb It’s a neat trick. In my spotlight last year I showed how to change them in 2005+ too, in dire circumstances :-)                      11/6/09 12:50 AM http://twitter.com/PaulRandal/statuses/5465461390 NULL
PaulRandal: See blog TechEd Demo: Using the SQL 2005 Dedicated Admin Connection to fix Msg 8992: corrupt system tables http://bit.ly/njh9B #sqlpass       11/6/09 12:52 AM http://twitter.com/PaulRandal/statuses/5465503209 #sqlpass 
PaulRandal: Any Tweeps coming to our disaster recovery #sqlpass post-con tomorrow?                                                                        11/6/09 1:01 AM http://twitter.com/PaulRandal/statuses/5465724325 #sqlpass 
PaulRandal: #sqlpass isn’t a conference, it’s one big SQL fun-fest with a bunch of new and old friends. What a damn good time!                            11/6/09 1:04 AM http://twitter.com/PaulRandal/statuses/5465784262 #sqlpass 
PaulRandal: @JustAGuy0479 Cool – see you tomorrow! Are you the guy I was supposed to slap if he fell asleep in KLT’s session yesterday?                   11/6/09 1:17 AM http://twitter.com/PaulRandal/statuses/5466115284 NULL
PaulRandal: KLT’s blog post http://bit.ly/1knEE2 RT @GFritchey: OH For filtered statistics, auto update of stats is useless. Do it yourself. – Gail Shaw  11/6/09 1:30 AM http://twitter.com/PaulRandal/statuses/5466422479 NULL
PaulRandal: Our house… RT @sqlbelle: #sqlpass feels like *home* ie where else can you find a place where everyone does some kind of SQL Server work     11/6/09 1:54 AM http://twitter.com/PaulRandal/statuses/5466999689 #sqlpass 

And here’s the whole list in a more readable format:
http://sqlvariant.com/BlogSupport/Images/TwitterRSSFavorites/PaulRandalPASS2009blog.xlsx