|
-
Originally posted by abhaysk
First of all let me explain u how characters or numbers are stored at hard ware level ( I mean it hard disk level & not even OS level )
Take for example a integer 0, it requires 4 bits to store ( as i said in my previous post & ther too i meant hard ware level and not OS or index level as these are logical rather than physical )......
And that 4 bits would be '0000' as binay bit values.
Now take how the character 'a' would be stored, it requires 8 bits & would be stored as ASCII equivalent 39 and in binary it would be '01101001'.
You are talking nonsence here. "Hardware level" (as you call it) doesn't store numbers or chars or dates or whatever - it only stores bits - zeroes and ones. That's all. When you store a data into the database, your OS or your controller or your disk doesn't know and doesn't care what kind of data you want to store - it simply writes the whole database block that DBWR has sent for write. So all the formatting of 0's and 1' in a database block is done by Oracle, and the database block is then simply broken down to multiple OS blocks which are written directly to disk, exactly the way as oracle has prepared them. And FYI, the number 0 stored in Oracle database doesn't occupy only 4 bits of your hard disk storage, it ocupies exactly 1 byte (8 bits). The number 1 will occupy 2 bytes, -1 will occupy 3 bytes, 999 will also require 3 bytes, while for example number 10000000000 will require only 2 bytes of your storage.
if u define char or varchar(2) then each character would require 1 byte to be stored at harware level.
Thats not true either. Each character stored in your database will occupy 1 or 2 bytes of your disk storage, depending on your database characterset.
if u define number then each digit will be stored in mantisa and exponention form which would also require 1byte, due 1 mantisa part would require 4 bits and exponent would require 4 bits......if its 2 digit number then it would require 12 bits.......
That's nonsence too. Read the previous explanation about how numbers are stored...
While insert on PK column oracle would search for the string, if its char type, if it existed in the table....may it search thru index it still need the help of CPU to comapre the String value......
And as i explained above CPU wud atleast take time 2 times than if it were to compare with Number.......
Wrong conclusions due to previously explained misunderstandings. The time difference even on a big table would be negligible, I can assure you.
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|