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 > DB2 CLOB fields

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-19-11, 19:11
pkumar210 pkumar210 is offline
Registered User
 
Join Date: Jul 2011
Posts: 9
Question DB2 CLOB fields

Hello Everyone,

I am new to DB2 and just started reading some of its concepts.
I have a problem in one of my projects which I am working on:
=> I have a table in which my user has created 12 CLOB fields with length as (99999), will this have any performance hit in future, considering the fact that we will have lot of data in this table?
=> Now after discussion user is ready to reduce this to each field of 4k length which means total of (12*4 = 48k ) and as per my reading of DB2 this will go beyond the pagefile size which is currently set to 32k. Am I correct inunderstanding this?

Now since CLOB field length is not counted in pagefile so CLOB is the best choice but then I suspect it would have a performance hit. Is there any other way I can deal this problem?


Thanks & Regards
Piyush
Reply With Quote
  #2 (permalink)  
Old 07-19-11, 20:20
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Generally speaking, it doesn't matter if you define LOB columns with a greater length - only the actual amount of space needed for each value will be allocated. In other words, it will make no difference if you alter the table and set LOB columns to a shorter length, as long as the actual data remain the same.

In DB2 9.7 you have an option to store LOB data "inline", that is, as a part of the actual table row (within the limits of the page size, of course). If that is the case, LOBs will be accessed as fast as the rest of columns. Otherwise, LOB data are stored in separate disk structures and are not cached in bufferpools, which means that an extra I/O operation is required to fetch them.

Another disadvantage of large LOB values is that they would require extra log space, unless the LOB columns are defined as NOT LOGGED. Keep in mind though that NOT LOGGED LOBs carry a risk of losing data in a crash.
Reply With Quote
  #3 (permalink)  
Old 07-21-11, 08:37
pkumar210 pkumar210 is offline
Registered User
 
Join Date: Jul 2011
Posts: 9
Question DB2 CLOB fields

So if I understand this correctly. It is not good to have 12 CLOB type fields here as extra I/O is required for the fetch operation.

The DB2 version we have currently is DB2 v9.1.0.4.

So if considerring the second option I have:
i.e.
=> Now after discussion user is ready to reduce this to each field of 4k length which means total of (12*4 = 48k ) and as per my reading of DB2 this will go beyond the pagefile size which is currently set to 32k. Am I correct in understanding this?

What can be done? Is creating 2 new tables for these 12 columns (6 of 4k length in each) and then creating a view out of these two is a good option?

Regards
Piyush
Reply With Quote
  #4 (permalink)  
Old 07-21-11, 09:39
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
In 9.1 LOBs cannot be inlined. Like I said, they are stored in separate structures that are outside of the "normal" row and therefore don't count toward the page size limit.

Whether it's good to have 12 LOB columns or not depends not on the amount of I/O required, but on whether you need these columns or not. If you need these data, you'd have to live with whatever I/O is needed to read and write them.
Reply With Quote
  #5 (permalink)  
Old 07-21-11, 09:40
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
pkumar210, you will need to read up on LOBs. LOBs are NOT stored on the same pages as the rest of the table (although, as n i pointed out the newer versions of DB2 can store a lob in-line (as long as it is smaller than 32K)). They are stored in another table space and do not have the 32K limit or a regular DB2 page.

I am not an expert on LOBs so I can't explain in more detail. But before you use them, you need to understand them as they take special handling / processing.
Reply With Quote
  #6 (permalink)  
Old 07-21-11, 10:27
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
The main problem with LOB's (unless they are inlined in V9.7 and the actual data length fits into the inline length) is that LOB I/O always requires synchronous disk I/O, whereas other DB2 data is cached in DB2 bufferpools. If you do use LOB's, make sure your table is defined with a separate LONG tablespace and make sure that file system caching is on for that tablespace.

Another option is to use VARCHAR or VARCHAR for Bit Data if the max column length is less than about 32,000 bytes each (but might be problem if you have lots of LOB columns in one table).
__________________
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
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