Oracle 10g small Blob or Clob not being stored inline?

前端 未结 5 948
一个人的身影
一个人的身影 2021-02-14 00:42

According to the documents I\'ve read, the default storage for a CLOB or BLOB is inline, which means that if it is less than approx 4k in size then it will be held in the table.

5条回答
  •  有刺的猬
    2021-02-14 01:19

    Indeed, it is stored within the row. You are likely dealing with the simple overhead of using a LOB instead of a varchar. Nothing is free. The DB probably doesn't know ahead of time where to find the row, so it probably still "follows a pointer" and does extra work just in case the LOB is big. If you can get by with a varchar, you should. Even old hacks like 2 varchars to deal with 8000 characters might solve your business case with higher performance.

    LOBS are slow, difficult to query, etc. On the positive, they can be 4G.

    What would be interesting to try is to shove something just over 4000 bytes into that clob, and see what the performance looks like. Maybe it is about the same speed? This would tell you that it's overhead slowing you down.

    Warning, at some point network traffic to your PC slows you down on these kind of tests.

    Minimize this by wrapping in a count, this isolates the work to the server:

    select count(*) from (select x,y from clobtest where rownum<1001)

    You can achieve similar effects with "set autot trace", but there will be tracing overhead too.

提交回复
热议问题