Columnas NCLOB vs NVARCHAR en la base de datos Oracle

I have to store variable length texts in an oracle table. The most of them will be less than 200 chars, but some of them ocasionally will have thousands of characters.

I'm tempted to define the column as NCLOB, as this datatype stores up to 4 GB, but I wonder what would be the problem in doing so as in the 98% of the times a NVARCHAR column would be enought.

  • The values will not change frecuently once inserted.
  • There will be hundred of thousands of records.

Muchas Gracias

preguntado el 31 de julio de 12 a las 11:07

1 Respuestas

Incluso si es %2, data is data, right? You have to store those minority data so you have to use CLOB.

Respondido 31 Jul 12, 13:07

You're right, but the alternative would be a more complex table structure. Maybe 1 NVARCHAR column and another NCLOB, or something like that. But if there's no performance problem using one only NCLOB column (there will be hundred of thousands of records) I'd go for the simpler way. - klautern

Cuando creas un NCLOB field, db creates a LOBINDEX and stores the field-data in the index. Si crea un NVARCHAR field db creates only table segment for storing field-data. If most of your queries are going to be SELECT queries, you should use NCLOB field because it is pre-indexed. But beware, your INSERTs y UPDATEs will be slower than NVARCHAR solution. You can create a manual index on NVARCHAR too, but this may cost you nearly double size of the data. And as for the storage side using NCLOB is beneficial. But for DML speed, use NVARCHAR campo. - Ciego de nieve

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.