Default if YourFault if you Falter

Results 1 to 3 of 3

Thread: Default if YourFault if you Falter

  1. #1
    Join Date
    Dec 1969

    Default Default if YourFault if you Falter

    By default, Access puts a default value of 0 (zero) in a number field (in the event that no value is entered for that field, when a record is added).<BR><BR>I changed this so that it would just leave it blank instead. Does the database work faster if a default value of zero is entered instead of leaving it blank? I have not noticed any differences, but I have heard that it is not good to have a lot of blank fields in a database.<BR><BR>What do you think?

  2. #2
    Join Date
    Dec 1969

    Default RE: Default if YourFault if you Falter

    From what I understand (I am no expert on this by far) access uses the same amount of disk space for a zero as it does for null or 655,360. there should be no speed change either way (if there is you would need to time by nano seconds to notice it)...<BR><BR>Flame me if I am wrong, but thats the way I have understood it since "Introduction to Microsoft Access - 101". of cource my teacher in that class had trouble finding the power button on his I-Mac at home, so take this info with a grain of salt. (O;,`

  3. #3
    Join Date
    Dec 1969

    Default Surely doesn't matter...

    I don&#039;t know how Access marks a field as being NULL. Whether it uses an extra byte or other flag someplace else to say "that field is NULL" or just has some "impossible" value for each data type.<BR><BR>Hmmm...just checked...Access allows all possible values for all bit patterns, so the info about a field containing NULL *must* be held in some auxilliary location.<BR><BR>So...<BR><BR>What difference does it make?<BR><BR>If you say a field is initialized to zero, Access has to set the flag to NON-null and put a zero into the field.<BR><BR>If you say the field is initialized to null, *maybe* Access can get away with just setting the flag to indicate NULL.<BR><BR>BUT...<BR><BR>But I&#039;d bet big money that Access *actually* always zeroes out the memory needed for a new record. It needs to do this for security reasons, so that a record won&#039;t contain junk that was left in memory from some other object/record/whatever. And that being so, then it&#039;s surely smart enough to realize that when you say "initialize to zero" it doesn&#039;t really need to do any other added work. <BR><BR>And then, too, I&#039;d bet that the "isNull" flag used for each field follows the same logic: zero because the buffer is zeroed. Changed only if needed.<BR><BR>Meaning that it is *possible* that a non-null and zero value is the fastest possible choice. <BR><BR>But I hope you realize we are likely talking NANO-seconds here. <BR><BR>[If I had designed Access, I would create a "prototype record" for each table that would, in a single memory-copy, initialize each new record instance to the defaults. In which case it would make ZERO difference what you set the defaults to, since no matter what the same memory-copy would occur. But that&#039;s my design. Your mileage--and Access&#039;s--may vary.]<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts