If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Best datatype for boolean data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-29-03, 14:29
studrew studrew is offline
Registered User
 
Join Date: Feb 2003
Posts: 17
Best datatype for boolean data

Hello,

What is the best/fastest db2 datatype to use as a boolean flag? I'm currently using 'smallint' which uses 16 bits. Would it be faster to use a char(1) which is only 8 bits? Also, is it true that text comparisons for ‘char’ are slower then binary comparisons for ‘smallint’? If so, would that make smallint faster? Thanks…

Andrew
Reply With Quote
  #2 (permalink)  
Old 09-29-03, 14:38
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
I was always told that on a hexadecimal byte machine like OS/390, the char comparison is faster. But on an octal word machine, the binary is faster.

I know that on OS/390, binary (smallint, int) should always be stored on a half word or word boundary if possible, and that for a comparison it will be moved to such a boundary if not already on that boundary. Not sure how DB2 handles that internally.

I am not sure how it works on Unix, Linux, or Windows OS’s.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On