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 > Data type for keep the file data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-04-09, 04:01
phanita phanita is offline
Registered User
 
Join Date: Sep 2009
Posts: 14
Data type for keep the file data

Hi,

I'm a newbie for DB2. Could you please suggest about the data type that is proper to keep the file in table?

Thank you in advance
Reply With Quote
  #2 (permalink)  
Old 10-04-09, 06:14
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Need to know the contents of the file or file types.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 10-04-09, 07:53
phanita phanita is offline
Registered User
 
Join Date: Sep 2009
Posts: 14
I've 2 kinds of data.
1. just text file
2. pdf file
Reply With Quote
  #4 (permalink)  
Old 10-04-09, 09:20
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
1. CLOB
2. BLOB

If the data was less than about 32K, you could use the following for better performance, but you will need a 32K bufferpool, tablespace, and system temporary tables:

1. VARCHAR
2. VARCHAR FOR BIT DATA
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 10-04-09, 23:35
phanita phanita is offline
Registered User
 
Join Date: Sep 2009
Posts: 14
Thank you very much.
Reply With Quote
  #6 (permalink)  
Old 10-06-09, 21:52
phanita phanita is offline
Registered User
 
Join Date: Sep 2009
Posts: 14
Hi,

I've estimated the file and found that we the file size will be around 200 - 300 kb per row so based on your suggestion I'd better used blob right?

How about the performance for this file size?

Thank you in advance.
Reply With Quote
  #7 (permalink)  
Old 10-07-09, 03:47
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
You would use BLOB for binary data (including a PDF), and CLOB for text data. Performance will not as good as regular data since LOB's do not use DB2 bufferpools (memory caching of DB2 tables) and will require synchronous disk I/O required for read and writes. But it may not be that bad depending on your requirements.

Best option is to define a separate 32K tablespace for LOB's and then use it the Create Table command ("LONG IN TS_XXXX" -- see Create Table command in manual), and make sure that file caching is turned on for that tablespace where the LOB's reside. If the LOB will not ever (or only rarely) be updated after it is inserted (deleted is a separate issue), then use the COMPACT keyword when defining the LOB column.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #8 (permalink)  
Old 10-07-09, 03:55
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
If you have a bunch of small files (smaller than 32K), you can wrap the BLOB inside a structured type and use a large INLINE LENGTH for that type. This will allow you to exploit the buffer pool for short BLOBs (< 32K) while everything longer is treated as a regular BLOB with disk I/O.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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