We help IT Professionals succeed at work.
Get Started

CLOB column performance

laxmareddyb
laxmareddyb asked
on
1,645 Views
Last Modified: 2008-02-01
I have a table in oracle DB with 3 columns:
CREATE TABLE MB_TRANSACTIONS(  
      NAME VARCHAR2(100) NOT NULL,
      CREATED_TS TIMESTAMP,
      MESSAGE CLOB NOT NULL
);
Inserts will be happened on this table through java Prepared statement:
<sql-definition>
      <sql>
            INSERT INTO ${PACKAGE}.MB_TRANSACTIONS(NAME,CREATED_TS, MESSAGE)
            VALUES(?,TO_DATE(?,'MM/DD/YYYY HH24:MI:SS'),?)
      </sql>
      <bindParams>
            <param seqNo="1" name="NAME" type="Types.VARCHAR"/>
            <param seqNo="2" name="CREATED_TS" type="Types.DATE"/>
            <param seqNo="3" name="MESSAGE" type="Types.CLOB"/>
      </bindParams>
</sql-definition>      
When the message size is large(7MB) PreparedStatement.execute() takes too long to Insert when  compared to smaller messages (1MB).
Large message time:
SQLStatement:execute() - Time took :31145ms
Smaller message:
SQLStatement:execute() - Time took :50ms

I am setting clob thru java code as follows:
 case Types.CLOB:
                   PreparedStatement cs;
                    if(value != null || !"".equals(value)){
                        cs.setObject(paramPosition, value);
                    }

My Questions:
1. Is there a way to improve the performance of the CLOB Fields ?
2. Do we need to consider any parameters on database while creating table with CLOB column.
3. Do I need to change any parameters on tablespace to make that fast?
4. Do I am doing Insertion in  a wrong way thru Java?




Comment
Watch Question
Database Developer & Administrator
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2012
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE