Preferred DB2 UDB Data Types
- Dieses Thema hat 0 Antworten und 1 Teilnehmer, und wurde zuletzt aktualisiert vor 18 Jahre, 6 Monaten von
DBSC_Info.
Ansicht von 1 Beitrag (von insgesamt 1)
- AuthorPosts
- 14. Dezember 2004 um 21:29 Uhr #2487
Hallo zusammen!
Immer wieder ein Wörtchen wert: Welche Datentypen sind werden von DB2 "bevorzugt"?!
Other considerations for data types
DB2 UDB allows you to use various data types. You can use SMALLINT, INTEGER, BIGINT, DECIMAL, REAL, and DOUBLE for numeric data; CHAR, VARCHAR, LONG VARCHAR, CLOB for character data; GRAPHIC, VARGRAPHIC, LONG VARGRAPHIC, and DBCLOB for the double byte character data, and so on. As the amount of database storage and the cost to process varies depending on the data type, you should choose the appropriate data type.
The following are guidelines when choosing a data type:
- Use character (CHAR) rather than varying-length character (VARCHAR) for short columns. The varying-length character data type can save database storage when the length of data values varies, but there is a cost to check the length of each data value.
- Use VARCHAR or VARGRAPHIC rather than LONG VARCHAR or LONG VARGRAPHIC. The maximum length for VARCHAR and LONG VARCHAR columns, VARGRAPHIC and LONG VARGRAPHIC are almost same (32,672 bytes for VARCHAR, 32,700 bytes for LONG VARCHAR, 16,336 characters for VARGRAPHIC, and 16,350 characters for LONG VARGRAPHIC), while LONG VARCHAR and LONG VARGRAPHIC columns have several restrictions. For example, data stored in LONG VARCHAR or LONG VARGRAPHIC columns is not buffered in the database buffer pool.
- Use integer (SMALLINT, INTEGER, BIGINT) rather than floating-point number (REAL or DOUBLE) or decimal (DECIMAL) if you do not need to have the fraction part. Processing cost for integers is much more inexpensive.
- Use date-time (DATE, TIME, TIMESTAMP) rather than character (CHAR). Date-time data types consume less database storage, and you can use some built-in functions for date-time data types such as YEAR and MONTH.
- Use numeric data types rather than character.
Quelle: IBM, DB2 UDB V7.1 Performance Tuning Guide
Grüße
Gernot - AuthorPosts
Ansicht von 1 Beitrag (von insgesamt 1)
You must be logged in to reply to this topic.