March 25, 2014 at 12:50 am
How much of a penalty do I get if I put a default constraint on all fields? In terms of speed, memory, etc. Any help would be appreciated.
Thanks,
Mike
March 25, 2014 at 3:52 am
It completely depends on how the constraints are defined. The primary pain points, if any, will be on inserts and updates. It won't affect selects at all. The best answer is to test it out. But without seeing how you're defining the constraints, I couldn't possibly tell you what's going to happen.
"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 25, 2014 at 7:33 am
The constraints would be simple ones - defaulting int types to 0, char to space(0), bit to 0, etc.
March 25, 2014 at 7:46 am
Default values are extremely low cost. I'm not even sure if you can measure that. You pass a NULL value and something else is used instead. When you said constraints I imagined IP address configurations, telephone numbers, that sort of thing. Those are higher cost and ones that you'd have to measure to be sure of.
"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
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply