I am making a table in which I am storing XML. To store XML I am using CLOB
data type. The max size of my XML would be 5kb.
What size of CLOB
column should I define while creating the table?
A CLOB (character large object) value can be up to 2,147,483,647 characters long.
GetLength – Find the size of BLOB/CLOB column. This is simply how to find the size of individual rows with the CLOB/BLOB column. DBMS_LOB. GetLength returns the number of characters (bytes) in the CLOB/BLOB column.
For compiling a PL/I application for OCI, declare BLOB and CLOB variables as shown: DCL TEST_BLOB SQL TYPE IS BLOB(4K); DCL TEST_CLOB SQL TYPE IS CLOB(2M); You can specify BLOB or CLOB host variable sizes in kilobytes (K), megabytes (M), Gigabytes (G), or as an integer value.
you don't define a size exactly when setting a clob (unlike a varchar). it is just simply clob
.
The max size of a lob is 4Gb.
Storage wise it will use space as follows:
when creating a lob column, you can specify its storage clause to control in-row and out-of-row options like this:
LOB (c) STORE AS lobseg (DISABLE STORAGE IN ROW CHUNK 16384)
i.e. that would specify that the lob can never be stored inline with the regular table data, and will allocate storage in multiples of 16kb per chunk, so even if your document was 1kb, it would take 16kb of storage.
if your xml documents are only 5kb, you may want to consider in-row storage, and put a small chunk size (the min chunk size is 1 block, so if you have a tablespace with 4kb extents, your minumum chunk size will be 4kb; if you specify less, it will be ignored). the disadvantage of allowing in-row lobs, is that the table will be larger, so large range scans may suffer a bit (but lob retrieval is faster).
Also in 11g you have the option to compress lob segments which you may want to consider (if your licence covers it). Though with such small documents you may not benefit greatly.
read more here : http://docs.oracle.com/cd/B28359_01/appdev.111/b28393/adlob_tables.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With