BorderLayoutBoxedLayoutOpenLayoutMaximum textMedium textSmall text


Register
Tuesday, February 09, 2010
MyStreamMinimize
Print  

Entries for the 'Captain Varchar(MAX)' Category

Capt. Varchar(MAX) and thePageLatch Posse Vol. 25

Posted by Jason Massie Click to IM Jason Massie on Friday, May 22, 2009 at 2:26 PM to Humor, Captain Varchar(MAX), syndicate
1074 Views | 0 Comments | Article Rating

Control Z

ControlZ

This post is inspired by the #famouslastwords thread on twitter today. If you are doing a major, minor or any change on a production system, have a rollback plan. This will probably go beyond restoring from backup especially if the data is large. From someone who has put in 24 hour+ shifts, plan and test as much as possible.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 24

Posted by Jason Massie Click to IM Jason Massie on Friday, May 15, 2009 at 2:05 PM to Humor, Captain Varchar(MAX), syndicate
852 Views | 0 Comments | Article Rating

I am not NULL!

IamnotNULL

Adapted from OfficeOFFline.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 23

Posted by Jason Massie Click to IM Jason Massie on Friday, April 10, 2009 at 5:56 PM to Humor, Captain Varchar(MAX), syndicate
832 Views | 0 Comments | Article Rating

You might be a geek if…

alarmclock

The stole this from the #youmightbeageek conversation going around twitter yesterday. Funny stuff. The original post is here.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 22

Posted by Jason Massie Click to IM Jason Massie on Friday, March 27, 2009 at 3:33 PM to Humor, Captain Varchar(MAX)
959 Views | 3 Comments | Article Rating

The T’aint

TAINT

If you don’t get it, bless your heart. If you do, don’t cry foul because you do not learn this phrase in Sunday School. Besides, it is ALWAYS the network!

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 21

Posted by Jason Massie Click to IM Jason Massie on Friday, February 27, 2009 at 12:20 PM to Humor, Captain Varchar(MAX), syndicate
1055 Views | 0 Comments | Article Rating

Ninja Fog

NinjaFog

The cloud has been all the buzz this week. Paul makes a prediction, Denis talks about the challenges, Steve chimes in and the register reports that Microsoft plans to release a full featured SQL Server to cloud. I have talked about this before but I got nothing but ninja fog today.

 

This comic was adapted from OfficeOFFline.

email it! |   |   | 

Capt Varchar(MAX) and the Pagelatch Posse Vol. 20

Posted by Jason Massie Click to IM Jason Massie on Friday, February 20, 2009 at 3:17 PM to Captain Varchar(MAX)
748 Views | 0 Comments | Article Rating

6 degrees of Virtualization

TooMuchVirtualization

You might think this is funny(or not) but this will be happening sooner or later.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 18

Posted by Jason Massie Click to IM Jason Massie on Friday, January 30, 2009 at 11:44 AM to SQL Server 2008, SQL Server 2005, Humor, Captain Varchar(MAX)
1280 Views | 4 Comments | Article Rating

The Senior DBA

TheSRDBA

I am astounded by how often I see a problem that I know nothing about but fix it after finding the answer in a search. I get more high fives for being a good search engine user than a good DBA. On the flipside, I learned this by asking dumb questions and getting sent back a google search link.

The comic was adapted from OfficeOffline.

email it! |   |   | 

Capt. Varchar(MAX) and the PageLatch Posse Vol. 17

Posted by Jason Massie Click to IM Jason Massie on Friday, January 16, 2009 at 9:46 AM to Humor, Captain Varchar(MAX)
1164 Views | 7 Comments | Article Rating

The Interview Question

BadAnswer

Yes, this really happened. He didn’t say “Duh” but he was so confident that he might as well have.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 16

Posted by Jason Massie Click to IM Jason Massie on Monday, December 15, 2008 at 10:19 PM to Humor, Captain Varchar(MAX), The Cloud, SQL Data Services
1437 Views | 5 Comments | Article Rating

I got a nice little surprise in my inbox today: The first reader submitted Captain Varchar comic from Rod Colledge of SQLCrunch.

Cloud-II

I have written about this twice. I pushed it here and I toned it down after the facts came in from PDC. TJay Belt also had some commentary on it here today.

The comic does raise another off topic but interesting point. Apple’s desktop market share has been gaining ground. What happens when SaaS makes the browser the OS? Yes, another stretch but that is where some “experts” think we are heading.

email it! |   |   | 

Capt. Varchar(MAX) and the PageLatch Posse VOL. 15

Posted by Jason Massie Click to IM Jason Massie on Friday, December 05, 2008 at 2:18 PM to Humor, Captain Varchar(MAX)
716 Views | 1 Comments | Article Rating

 Guess who the victim of this deadlock is?

On the technical tip, the "end all be all" of deadlock troubleshooting can be found here.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 14

Posted by Jason Massie Click to IM Jason Massie on Friday, November 07, 2008 at 11:21 AM to Humor, Captain Varchar(MAX)
783 Views | 3 Comments | Article Rating

This post was inspired by the SQL Quiz going around that that Chris started, while humorous, can help us learn from each others mistakes.

Over the years, I have gone from a mental project plan to notepad to excel to MS project. My success % has increased and fire fights have decreased for major changes. I recommend it.

A Mental(ly Disturbed) Note

mental

The comic template was adapted from OfficeOFFline.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 13

Posted by Jason Massie Click to IM Jason Massie on Friday, October 31, 2008 at 1:08 PM to Humor, Captain Varchar(MAX)
1082 Views | 9 Comments | Article Rating

Once again, I was struggling for a Varchar(MAX) topic and twitter came through. This comic is based on these two tweets.

Update: Anarchy has erupted on twitter. Brent blogged it here.

 

clip_image001

BrentO If yo momma was a table, she'd be a heap. #SQLputdowns
Fri, Oct 31 12:31:24 from mobile web

clip_image002[6]

jeffrush @BrentO If she was a datatype, she'd be a BLOB
Fri, Oct 31 12:37:41 from OutTwit

 

Yo Mamma is a SQL Server

yomamma

This template is based on Office OFFline.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 12

Posted by Jason Massie Click to IM Jason Massie on Friday, October 17, 2008 at 2:03 PM to Humor, Captain Varchar(MAX)
747 Views | 1 Comments | Article Rating

This post was inspired by a twitter conversation between @SQLCraftman and @Joewebb.

clip_image001

joewebb @SQLCraftsman TVF's don't kill servers, developers with TVFs kill servers. :)
Fri, Oct 17 13:42:42 from twhirl

clip_image001[4]

SQLCraftsman Still recoding bad T-SQL. Table-Valued Functions are evil.
Fri, Oct 17 13:16:43 from web

For further information, I suggest reading my favorite whitepaper especially the best practices section.

 

TVF

email it! |   |   | 

Capt. Varchar(MAX) and the Faillatch Posse

Posted by Jason Massie Click to IM Jason Massie on Friday, October 10, 2008 at 10:41 PM to Humor, Captain Varchar(MAX)
645 Views | 0 Comments | Article Rating

I am out of town. Look for it Monday or before. Until then I give you:

fail owned pwned pictures

 

But hey if it works, then Darwinism is kinky… Maybe this is how cowboy hats evolved.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 11

Posted by Jason Massie Click to IM Jason Massie on Friday, October 03, 2008 at 3:18 PM to Humor, Captain Varchar(MAX)
950 Views | 1 Comments | Article Rating

Was struggling for some comic fodder today. Like for at least 7 minutes. Then I remembered a blog post that BrentO wrote yesterday and blam. Humor(or lack of) aside, test your fracking backups.

wanda

This template was adapted from Office OFFline.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 10

Posted by Jason Massie Click to IM Jason Massie on Friday, September 26, 2008 at 4:05 PM to Humor, Captain Varchar(MAX)
699 Views | 0 Comments | Article Rating

SQLOS uses a cooperative scheduler. They actually wrote it from the ground up because it performs better than the Windows preemptive scheduler. KenH(R.I.P.) describes it way better than I can here. It was written for SQL 2000 but is still pretty applicable.

Less Signal Wait. More CPU lovin’

UMS

Maybe I will come up with something funny next week. Happy Friday!

This comic was adapted from Office OFFline.

email it! |   |   | 

Capt. Varchar(MAX) and the Pagelatch Posse Vol. 9

Posted by Jason Massie Click to IM Jason Massie on Friday, September 19, 2008 at 11:27 AM to Humor, Captain Varchar(MAX)
789 Views | 3 Comments | Article Rating

How many times have you heard “Cursors are evil”? Well, +1.

A cursor vs. set based solution

Set Based

Happy Friday.

This comic was adapted from Office OFFline.

email it! |   |   | 

Capt. Varcahr(MAX) and the Pagelatch Posse Vol. 8

Posted by Jason Massie Click to IM Jason Massie on Friday, September 12, 2008 at 11:10 AM to Humor, Captain Varchar(MAX)
1007 Views | 2 Comments | Article Rating

I have be running into this problem more often. The exact error message is "A significant part of sql server process memory has been paged out. This may result in performance degradation". It is  usually easy to work around if you are on Enterprise Edition but on standard edition, you have to actually fix the problem. :) I have actually had to to do a couple of edition upgrades because the customer could not fix the root cause.

Random Access Memories

RANDOM_ACCESS_MEMORY

Template courtesy of Office OFFline.

email it! |   |   | 

Captain Varchar(MAX) and the Pagelatch Posse 7

Posted by Jason Massie Click to IM Jason Massie on Friday, August 29, 2008 at 9:08 AM to Humor, Captain Varchar(MAX)
1096 Views | 0 Comments | Article Rating

This is my humble follow up to the, now classic, xkcd strip on little Bobby Tables.

btables

email it! |   |   | 

Captain Varchar(max) and the Pagelatch Posse 6

Posted by Jason Massie Click to IM Jason Massie on Friday, August 22, 2008 at 11:22 AM to Humor, Captain Varchar(MAX)
654 Views | 2 Comments | Article Rating

This post was inspired by this MSDN forum question and with nudge from BrentO.

WordPad FTW!

 

WordPad

email it! |   |   | 

Captian Varchar(Max) and the Pagelatch Posse 5

Posted by Jason Massie Click to IM Jason Massie on Friday, August 15, 2008 at 11:35 AM to Humor, Captain Varchar(MAX)
656 Views | 0 Comments | Article Rating

To go a long with my previous post, I give you a Friday funny.

Intelligent Design?

IntelligentDesign

email it! |   |   | 

Captain Varchar(MAX) and the Pagelatch Posse 3

Posted by Jason Massie Click to IM Jason Massie on Friday, July 25, 2008 at 2:19 AM to Humor, Captain Varchar(MAX)
828 Views | 2 Comments | Article Rating

Time for TRY\CATCH in politics?

DamnTheMan

Happy Friday.

email it! |   |   | 

Captain Varchar(MAX) and the PageLatch Posse #2

Posted by Jason Massie Click to IM Jason Massie on Friday, July 18, 2008 at 3:55 PM to Humor, Captain Varchar(MAX)
638 Views | 0 Comments | Article Rating

Phantom Records

varchar2

email it! |   |   | 

The Perils of SQL Profiler

Posted by Jason Massie Click to IM Jason Massie on Monday, July 14, 2008 at 3:02 PM to SQL Server 2008, SQL Server 2005, Procedure Cache, DMVs, Captain Varchar(MAX)
2350 Views | 8 Comments | Article Rating

profiler I posted the first Captain VarChar(MAX) comic last Friday. It takes a swing at profiler. A lot of you are like “Duh!”. I have just done too many dba interviews where the candidate’s default answer is profiler. The interview usually gets tough or really short at that point. Just say no to SQL profiler.

I really have to stretch my imagination to come up with a situation where using SQL Profiler sounds like a good idea. For example, you quickly want to capture “ordered” events when repro’ing a problem in your *test* environment AND you filter it by your SPID. Any other time, you are wasting lots of time, cause performances overhead and probably missing what you are looking for while digging for the needle in the haystack. Also contrary to popular belief, running the GUI on another machine DOES NOT help much. For the rest of the post when I refer to a trace, I am referring to one captured with a server side trace unless I say “profiler” or “GUI”

I will admit that I have brought a production app to its knees with profiler. Picture this. You get a call while you are running profiler that the app is having issues. At first you think, “Hey, I have a trace running so at least I will be able to pinpoint the problem.” Then you see TRACE_WRITE wait types. Your stomach knots up because you realize that you just caused a production outage. Don’t be that guy(or gal).

SQL 2005+ just gives you too much info through the DMV’s. 90%+ of the time you can use the DMV’s instead of Profiler. The other 10% of the time, use a server side trace not the Profiler GUI. I have never seen a server side trace bring down an app. Even unfiltered traces on highly transactional systems where a gigabyte+ is collected every minute. I can see it causing an issue but the server would have to be pretty max’ed out to begin with.

Lastly, a trace only reports CPU, Reads, Duration etc when the query completes. Query completion for a misbehaving query could take 10x to 100x longer than normal. This makes traces unusable in a lot of cases when troubleshooting.

Let’s look at some scenario’s:

Troubleshooting a performance issue that is currently happening

A SQL trace in this situation is almost never needed on SQL 2005+. I troubleshoot like this:

1) See if\what hardware subsystem is pegged out with about 5 or 6 perfmon counters.

a) Verify with DMV data or wait stats if needed.

2) Identify the problematic queries with the sys.dm_exec_% DMV's

3) Fix.

Here is the query I use. In a nutshell, it grabs a snapshot, waits a second and does a diff so I can see what is currently slamming the server. Otherwise, the cumulative CPU and IO columns might throw me off. I also grab the query plan which is easy here but very expensive in a trace and hard to correlate with the SQL completed event.

select r.cpu_time 
, r.logical_reads
, r.session_id 
into #temp
from sys.dm_exec_sessions as s 
inner join sys.dm_exec_requests as r 
on s.session_id =r.session_id --and s.last_request_start_time=r.start_time
where is_user_process = 1 
 
waitfor delay '00:00:01'
 
select 

substring(h.text, (r.statement_start_offset/2)+1 ,

((case r.statement_end_offset when -1 then datalength(h.text)

else r.statement_end_offset end - r.statement_start_offset)/2) + 1) as text
, r.cpu_time-t.cpu_time as CPUDiff 
, r.logical_reads-t.logical_reads as ReadDiff
, p.query_plan
, r.wait_type
, r.wait_time
, r.last_wait_type
, r.wait_resource
, r.command
, r.database_id
, r.blocking_session_id
, r.granted_query_memory
, r.session_id
, r.reads
, r.writes
, r.row_count
, s.[host_name]
, s.program_name
, s.login_name
from sys.dm_exec_sessions as s 
inner join sys.dm_exec_requests as r 
on s.session_id =r.session_id and s.last_request_start_time=r.start_time
full outer join #temp as t on t.session_id=s.session_id
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) h
cross apply sys.dm_exec_query_plan(r.plan_handle) p
order by 3 desc
 
drop table #temp

 

Proactive performance tuning

Now this starts to get in to fuzzy territory. Technically, a SQL trace is more thorough than doing your analysis off of the procedure cache. However, I would say benefits outweigh the losses in most but not all cases.

Procedure Cache Pro’s

· No need to capture a trace

· No need to load a trace

· Aggregation already exists so the data can be smaller assuming that the application has good plan reuse.

· Easy access to XML Showplan

Procedure Cache Con’s

· Queries can be flushed until next execution for many reasons

· Some queries are not cached. These are usually queries that you don’t care about.

To replace SQL trace analysis with a DMV query, use something like this:

select total_worker_time/execution_count as AvgCPU  
, total_elapsed_time/execution_count as AvgDuration  
, (total_logical_reads+total_physical_reads)/execution_count as AvgReads
, execution_count   
, substring(st.text, (qs.statement_start_offset/2)+1 , 
((case qs.statement_end_offset when -1 then datalength(st.text) 
else qs.statement_end_offset end - qs.statement_start_offset)/2) + 1) as txt  
, query_planfrom sys.dm_exec_query_stats as qscross apply sys.dm_exec_sql_text(qs.sql_handle) as stcross apply sys.dm_exec_query_plan (qs.plan_handle) as qp
--where – filter as needed.
--group by – Consider striping literals and grouping by the SQL text. 
--See Inside SQL Server 2005 for more info.
--Order by – Sort as needed.

Uncommon cases

There are some less common uses of SQL traces like the blocked process report, deadlock report, recompile tracing and many others. Make sure you review all of your options and don’t forget about the WMI Provider for Server Events. Use your best judgment and avoid the GUI like the plague.

Conclusion

To summarize very briefly: Never use the SQL Profiler GUI, know your tools, and pick the best one for the job.

email it! |   |   | 

Captain Varchar(MAX) & the PageLatch Posse Episode 1 - The Tech Interview

Posted by Jason Massie Click to IM Jason Massie on Friday, July 11, 2008 at 1:30 PM to Humor, Profiler, Captain Varchar(MAX)
2162 Views | 3 Comments | Article Rating

I have been wanting to do a SQL comic for quite some time. The problem is I really suck at art. My 4 year old laughs at my stick figures. However, @DavidSalaguinto does a comic on MSDN and has shared the Visio template. Thanks David!

I have a post half written on the perils of SQL Profiler so I thought I would drop a prelude to it. If you are asking yourself what is wrong with profiler, keep coming back.

 

The Technical Interview

TechnicalInterview

Happy Friday.

email it! |   |   | 

Page 1 of 1First   Previous   Next   Last   


Copyright 2006 by Statistics IO, My SQL Server Blog