Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Table space usage 1 Expand / Collapse
Author
Message
Posted Tuesday, November 8, 2011 11:20 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 6,128, Visits: 8,393
Comments posted to this topic are about the item Table space usage 1


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1202625
Posted Tuesday, November 8, 2011 11:37 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Friday, May 9, 2014 12:47 AM
Points: 3,448, Visits: 4,407
Nice and easy question.
I am very surprised that by now I am the only one (out of twenty) with the correct answer


  Post Attachments 
Answers.png (371 views, 3.41 KB)
Post #1202633
Posted Wednesday, November 9, 2011 12:25 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, December 12, 2014 12:49 AM
Points: 1,389, Visits: 515
The space used to store nullable fields is the only bottleneck. I missed it.
Post #1202652
Posted Wednesday, November 9, 2011 12:49 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, March 26, 2014 8:16 AM
Points: 161, Visits: 142
A good question!

It was not easy to get it right, I really learned something.
Post #1202660
Posted Wednesday, November 9, 2011 1:08 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, December 12, 2014 12:44 AM
Points: 1,693, Visits: 2,139
whoop whoop! I learnt something
But I got the answer wrong
Post #1202670
Posted Wednesday, November 9, 2011 1:26 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 6:55 AM
Points: 9,928, Visits: 11,203
Good question. The explanation could have been improved very slightly:

"SQL Server will use the same amount of storage for a column whether its value is NULL or a "real" value."

This is true for fixed-length types (both DATETIME and NCHAR used in the example are fixed-length) but variable length columns e.g. of VARCHAR type use no room in the data row - the null bitmap is used to distinguish between NULL and an empty string.




Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #1202679
Posted Wednesday, November 9, 2011 1:51 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, December 2, 2014 8:35 AM
Points: 968, Visits: 1,173
Nice question.Hough difficult for me.Really learnt something thanks.

“When I hear somebody sigh, ‘Life is hard,’ I am always tempted to ask, ‘Compared to what?’” - Sydney Harris
Post #1202695
Posted Wednesday, November 9, 2011 2:02 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 8:51 AM
Points: 83, Visits: 107
Really enjoyed this question .. pity I got it wrong but I have definitly learnt something!:

Lucy Dickinson
BI SQL Developer
Post #1202698
Posted Wednesday, November 9, 2011 2:05 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 6,128, Visits: 8,393
Thanks, all, for the kind words!


SQL Kiwi (11/9/2011)
Good question. The explanation could have been improved very slightly:

"SQL Server will use the same amount of storage for a column whether its value is NULL or a "real" value."

This is true for fixed-length types (both DATETIME and NCHAR used in the example are fixed-length) but variable length columns e.g. of VARCHAR type use no room in the data row - the null bitmap is used to distinguish between NULL and an empty string.

Good addition, Paul. For varying length data, my explanation is technically still correct, but indeed incomplete. For varying legth data, NULL takes the same amount as the shortest possible "real" value (which is teh empty string for varchar and nvarchar, and a zero-length binary string for varbinary).


Advance warning as a special service for those who take the time to read the discussion - the next question in this series (scheduled to go live in about a week) will involve some heavy arithmetic!



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1202699
Posted Wednesday, November 9, 2011 2:39 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 6:55 AM
Points: 9,928, Visits: 11,203
Hugo Kornelis (11/9/2011)
Advance warning as a special service for those who take the time to read the discussion - the next question in this series (scheduled to go live in about a week) will involve some heavy arithmetic!

Oh joy!




Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #1202713
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse