PostgreSQL supports both clob
and text
data types for storing large texts. I've used clob
data type as we are migrating the DB from Oracle. I understand that the clob
data type in PostgreSQL can only store up to 1GB of text rather than the 4GB in oracle.
Since my text size is well below 1GB, I am fine with using either of these types. So can I use PostgreSQL clob datatype or is there any advantage for text
datatype over clob
?
Any help will be much appreciated and Thanks in Advance.
PostgreSQL supports both clob and text data types for storing large texts.
Large Objects can also be handled in a more conventional manner using data types CLOB and BLOB. In Postgres, these data types are stored in a single system table called 'pg_largeobject' which has to be accessed via identifiers of data type OID which are stored with the table using BLOB/CLOB data.
A CLOB (character large object) value can be up to 2,147,483,647 characters long. A CLOB is used to store unicode character-based data, such as large documents in any character set.
The difference between the 2 types is that in VARCHAR2 you have to specify the length of the stored string and that length is limited to 4000 characters while CLOB can store up to 128 terabytes of character data in the database.
The clob
data type is unsupported in Postgres. However, it can be easily defined as a synonym to the text
type:
create domain clob as text;
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