March 21, 2011 at 2:57 am
Can I create statistics for temp table explicitly?
One of my proc is showing Clustered index scan for a temp table with no column statistics inturm casuing a parallelism.
Any suggestions?
March 21, 2011 at 3:29 am
Yes, you can create stats manually, though an index should already have statistics on it.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 21, 2011 at 5:53 am
If you're getting an index scan, you should try to understand why. Is there something in the code, such as a function on the column, that is causing the scan? is the table very small so scanning the pages is as fast as a seek? Usually understanding why something is occurring is the first step towards fixing it.
On parallelism, what's your system's cost threshold for parallelism? The default, 5, is way too low for most OLTP systems in my opinion.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
March 21, 2011 at 6:07 am
Grant Fritchey (3/21/2011)
If you're getting an index scan, you should try to understand why. Is there something in the code, such as a function on the column, that is causing the scan? is the table very small so scanning the pages is as fast as a seek? Usually understanding why something is occurring is the first step towards fixing it.On parallelism, what's your system's cost threshold for parallelism? The default, 5, is way too low for most OLTP systems in my opinion.
What should it be set to?
March 21, 2011 at 6:14 am
Ninja's_RGR'us (3/21/2011)
Grant Fritchey (3/21/2011)
If you're getting an index scan, you should try to understand why. Is there something in the code, such as a function on the column, that is causing the scan? is the table very small so scanning the pages is as fast as a seek? Usually understanding why something is occurring is the first step towards fixing it.On parallelism, what's your system's cost threshold for parallelism? The default, 5, is way too low for most OLTP systems in my opinion.
What should it be set to?
It depends.
😀 Sorry, you were asking for that....
Seriously, it should be set to a value that, for your system, keeps queries that should be serial serial and lets those that benefit from parallelism parallel.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 21, 2011 at 6:17 am
GilaMonster (3/21/2011)
Ninja's_RGR'us (3/21/2011)
Grant Fritchey (3/21/2011)
If you're getting an index scan, you should try to understand why. Is there something in the code, such as a function on the column, that is causing the scan? is the table very small so scanning the pages is as fast as a seek? Usually understanding why something is occurring is the first step towards fixing it.On parallelism, what's your system's cost threshold for parallelism? The default, 5, is way too low for most OLTP systems in my opinion.
What should it be set to?
It depends.
😀 Sorry, you were asking for that....
Seriously, it should be set to a value that, for your system, keeps queries that should be serial serial and lets those that benefit from parallelism parallel.
Thanks Gail but I was talking to Grant ;-).
March 21, 2011 at 6:37 am
Ninja's_RGR'us (3/21/2011)
GilaMonster (3/21/2011)
Ninja's_RGR'us (3/21/2011)
Grant Fritchey (3/21/2011)
If you're getting an index scan, you should try to understand why. Is there something in the code, such as a function on the column, that is causing the scan? is the table very small so scanning the pages is as fast as a seek? Usually understanding why something is occurring is the first step towards fixing it.On parallelism, what's your system's cost threshold for parallelism? The default, 5, is way too low for most OLTP systems in my opinion.
What should it be set to?
It depends.
😀 Sorry, you were asking for that....
Seriously, it should be set to a value that, for your system, keeps queries that should be serial serial and lets those that benefit from parallelism parallel.
Thanks Gail but I was talking to Grant ;-).
It depends.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
March 21, 2011 at 6:40 am
Yous guys are made for each other... you'd make a nice couple!! 😀
March 21, 2011 at 6:43 am
Ninja's_RGR'us (3/21/2011)
Grant Fritchey (3/21/2011)
If you're getting an index scan, you should try to understand why. Is there something in the code, such as a function on the column, that is causing the scan? is the table very small so scanning the pages is as fast as a seek? Usually understanding why something is occurring is the first step towards fixing it.On parallelism, what's your system's cost threshold for parallelism? The default, 5, is way too low for most OLTP systems in my opinion.
What should it be set to?
Because of how the optimizer costs the plans, something higher. Personally, I set it to between 25 & 35 on my production OLTP systems. If a plan has a cost beyond that number, I'm fairly certain that parallelism might help.
But it's like Gail said, you have to test it. I just prefer setting that number really high to turning off parallelism completely, which a lot of people do.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
March 21, 2011 at 6:47 am
Thanks for the info.
I ask because I support Ms Dynamics Nav which as you may know is extremely rbar, so this info can come in handy in the future.
Thanks for the more detailed answer !
March 21, 2011 at 6:51 am
DOP setting is 4. We do not wanna set to 1 as am not finding any other occurances. Even I find something, I will try to make not to happen by working on the index or code.(our's OLTP system)
Here the case is like the below:
1. Temp table has 5000 records. It shows no clumn stats in operator. (only for fetching from this table it shows parallelism) and followed by the below
2. The execution again shows a Split and filter for updating two indexes.(This I can see only in production. I am not able to see this in my development server. I do not have any clue....:hehe:
March 21, 2011 at 6:55 am
sqlchanakya (3/21/2011)
DOP setting is 4. We do not wanna set to 1 as am not finding any other occurances. Even I find something, I will try to make not to happen by working on the index or code.(our's OLTP system)Here the case is like the below:
1. Temp table has 5000 records. It shows no clumn stats in operator. (only for fetching from this table it shows parallelism) and followed by the below
2. The execution again shows a Split and filter for updating two indexes.(This I can see only in production. I am not able to see this in my development server. I do not have any clue....:hehe:
we were talking about cost threshold, not max DOP.
March 21, 2011 at 6:58 am
sqlchanakya (3/21/2011)
1. Temp table has 5000 records. It shows no clumn stats in operator. (only for fetching from this table it shows parallelism) and followed by the below2. The execution again shows a Split and filter for updating two indexes.(This I can see only in production. I am not able to see this in my development server. I do not have any clue....:hehe:
Execution plan please, table definitions and any index definitions also.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 21, 2011 at 7:02 am
It my bad....11%
March 21, 2011 at 7:04 am
we need the actual .sqlplan file!
Viewing 15 posts - 1 through 15 (of 21 total)
You must be logged in to reply to this topic. Login to reply