Hi everyone!
I need to store some HTML content in a database, and the value can be quite long. I'm wondering: what is the maximum size of text that can be stored in a database in ODC? I couldn't find this information anywhere.
Hi @Łukasz Kaproń ,
Please check the below link:
https://success.outsystems.com/documentation/outsystems_developer_cloud/building_apps/data_management/best_practices_for_data_management/
In addition to that, I would recommend you to store it as binary data so that there will be no limitation for you to store any length of text in db.
For conversion you can use below library:
Regards,
Manish Jawla
Hi
In OutSystems, if your content exceeds 2000 characters, the platform automatically uses NVARCHAR(MAX) in SQL Server back-end databases. This maps to a CLOB-like storage with no practical limit (up to 2 GB theoretically) Below 2000 characters, it uses nvarchar(n) (n defined in your model).
Check below reference
https://www.outsystems.com/forums/discussion/93510/data-longer-than-2-thousand-characters-wil-be-text-or-binary/
Because this is a table for html pages we may be talking of only a few records, but in general it is not a good idea - performance-wise - to go above 2000 characters.
In ODC the backend is an Aurora PostgreSQL database. Amit above described the behaviour in OutSystems 11 with a SQL Server backend, but the principle is the same, though I do not know the exact character count. In PostgreSQL smaller length text attributes (I dont know the exact length) are stored as varying char with a maximum length as given. Everything beyond that threshold is stored in the database as a PostgreSQL text data type. In general PostgreSQL Text attributes can have a maximum length of 1 GB.
As Nuno already wrote large texts should be treated like a binary file of any size and just like Nuno my recommendation is NOT to store such items in the database but use an external object store (S3) to store and retrieve such items.
Best
Stefan
Even though the database can store large binary data, you cannot upload more than the request payload size limit. ODC enforces a request payload limit of approximately 28.6 MB (https://success.outsystems.com/documentation/outsystems_developer_cloud/getting_started/outsystems_system_requirements_for_odc/#platform-limits). For larger files, the recommended approach is to store them in external storage, as others have suggested.
Since you mentioned that your requirement is to store HTML, it’s worth considering how large these files can realistically be. Modern browsers can render HTML files that are hundreds of MBs in size, but such large files often result in slow rendering, high memory usage, and unresponsive pages. If your HTML files are very large, you should store them in external storage. However, if they are relatively small (a few KBs or up to around 1 MB), storing them as a binary attribute in an OutSystems entity is reasonable.
Adding to Siya's answer. If you want to know how to overcome the platform limits by using an external S3 store, you may find my tutorials series helpful: https://without.systems/series/odc-s3-file-handling-series