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 08, 2011 11:20 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:32 PM
Points: 5,794, Visits: 8,006
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 08, 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: Thursday, April 10, 2014 7:08 AM
Points: 3,448, Visits: 4,406
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 (368 views, 3.41 KB)
Post #1202633
Posted Wednesday, November 09, 2011 12:25 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 12:16 AM
Points: 1,231, Visits: 447
The space used to store nullable fields is the only bottleneck. I missed it.
Post #1202652
Posted Wednesday, November 09, 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 09, 2011 1:08 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 5:02 AM
Points: 1,652, Visits: 2,075
whoop whoop! I learnt something
But I got the answer wrong
Post #1202670
Posted Wednesday, November 09, 2011 1:26 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:53 PM
Points: 11,168, Visits: 10,929
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 09, 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: Yesterday @ 6:47 AM
Points: 934, Visits: 1,153
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 09, 2011 2:02 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 10:31 AM
Points: 80, Visits: 103
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 09, 2011 2:05 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:32 PM
Points: 5,794, Visits: 8,006
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 09, 2011 2:39 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:53 PM
Points: 11,168, Visits: 10,929
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