关系数据库中的动态列大小
Dynamic column sizes in relational databases
假设我们有一个系统,其中包含一个关系数据库(例如,MySQL 或 Oracle),该数据库由使用来自外部 API 的数据的计划作业填充。还假设无法保证来自 API.
的数据大小(例如 json 的特定值的大小)
在这种情况下,为使用来自 API 的数据填充的特定属性确定合适的列大小的最佳做法是什么?它是根据传入数据动态(以编程方式)调整列大小的合适方法,还是我们分配相对较大的大小以容纳传入的较大数据?
谢谢。
[A]ssume there are no guarantees for the size of data (e.g. size of a particular value of a json) coming from the API.
In this kind of a scenario, what is the best practice to determine a proper column size for a particular attribute populated using data coming from the API?
在 Oracle 中,您可以使用 CLOB
数据类型。
Say, [...] Oracle, for instance
在 Oracle 中,VARCHAR2
列在 SQL 范围内限制为 4000 字节。如果您不能保证数据的大小,请使用 CLOB
。在 Oracle 19c 中,CLOB
数据类型具有 a limit 的 4GB * DB_BLOCK_SIZE
初始化参数(总大小为 8 TB 到 128 TB)。如果您超出了该限制,那么您应该认真考虑重新处理您使用数据的方式。
假设我们有一个系统,其中包含一个关系数据库(例如,MySQL 或 Oracle),该数据库由使用来自外部 API 的数据的计划作业填充。还假设无法保证来自 API.
的数据大小(例如 json 的特定值的大小)在这种情况下,为使用来自 API 的数据填充的特定属性确定合适的列大小的最佳做法是什么?它是根据传入数据动态(以编程方式)调整列大小的合适方法,还是我们分配相对较大的大小以容纳传入的较大数据?
谢谢。
[A]ssume there are no guarantees for the size of data (e.g. size of a particular value of a json) coming from the API.
In this kind of a scenario, what is the best practice to determine a proper column size for a particular attribute populated using data coming from the API?
在 Oracle 中,您可以使用 CLOB
数据类型。
Say, [...] Oracle, for instance
在 Oracle 中,VARCHAR2
列在 SQL 范围内限制为 4000 字节。如果您不能保证数据的大小,请使用 CLOB
。在 Oracle 19c 中,CLOB
数据类型具有 a limit 的 4GB * DB_BLOCK_SIZE
初始化参数(总大小为 8 TB 到 128 TB)。如果您超出了该限制,那么您应该认真考虑重新处理您使用数据的方式。