Re: Help Data-Types

From: GoranG <no_at_spam.net>
Date: Mon, 19 Aug 2002 18:33:24 +0200
Message-ID: <ol42mugsha2nmkr28h6gh63d8evca24pf6_at_4ax.com>


On Mon, 19 Aug 2002 14:40:27 +0100, Paul Vernon <paul.vernon_at_ukk.ibmm.comm> wrote:

>>>Four integer columns?
>>My first idea as well. Seems that nothing is lost by normalizing and a
>>lot is gained...
>
>Hey, why not 32 columns of type BIT ?!?.

Hmm, tempting :)

>>Then, enforsing constraints and querieng is the
>>simplest of all. Alternatively, it could be just a single integer:
>>
>>a3*256^3+a2*256^2+a1*256^1+a0
>
>Arrrgg. If you store them as 32bit INTEGERs you don't need no dam
>constraints!

>> However textual representation seems cheaper (speed vs space costs)
>>, faster (in most cases, since it is already formatted)
>
>My betting is that a CPU can do bit shifts quicker that getting a 11 more
>bytes from RAM/disk

Seems reasonable - but is it really so?

To go from 32 bit INTEGER to formated text you need to

1. bit operation(s) to get the first octet
2. conert to text 
3. append dot
4. do bit operation(s) to get the second octet
5. convert to text
6. append to existing text
7. append dot
8. do bit operation(s) to get the thrid octet
9. convert to text
10. append to existing text
11. append dot
12. do bit operation to get the last octet
13. convert to text
14. append to existing text

So even all of this is much faster then getting additional data? (I am asking since you did do a project with that representation and I guess that you did some testing and I guess you do have some test numbers and I would like to hear them... pleease).

>> Final digressions - does the following statement hold water?:
>> For all proposed data types there exist semantics in which the
>> proposed data type is the better then all other.
>
>With a DBMS that supports multiple possible representations (of DataTypes)
>one does not need to choose between different representation at the
>logical level.

I was under impression that by deciding between 4 properties and 1 property of appropriate domains one chooses more than a physical representation.
I thought that the process of determining weather IP is a scalar value property or non-scalar falls under logical modeling regardless of
representation?

Are you saying that this decission, while it does happen at the logical level should not happen (or matter) at the logical level since it does not matter how you define it (at logical level)? It could be hard to find problem space in which IP address' octets (or even bits as suggested at first) but not the whole IP participates in relationships - but if such problem space needs to be modeled then you would support multi property model. Or?

<cut>
p.s. I don't mind being corrected if you don't mind correcting.

( GoranG79 AT hotmail.com ) Received on Mon Aug 19 2002 - 18:33:24 CEST

Original text of this message