Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    17

    Unanswered: 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

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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.

Posting Permissions

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