PostgreSQL中数组类型的大小/长度限制 [英] size/length limitation of array type in PostgreSQL
问题描述
我正在使用PostgreSQL作为数据库的网络项目。我正在尝试建立包含向量空间模型表的网络数据库结构。
我创建了一个具有属性 terms
和 docId []
的表,其中 docId
是术语的文档ID。 docId
的类型为integer []。因此,我可以在文档列表中输入一个包含单个术语的术语。但是docId的术语数组可能包含很多条目。
I'm working a web project with PostgreSQL as a databases. I'm trying to build a structure of the web's databases that include a vector space model table.
I created a table with attribute terms
and docId[]
where docId
is the document ID of the term. type of the docId
is integer[]. So I can input a term with the document list that include the term in one single array. But the docId's array of term maybe will containing a lot of entries.
所以我的问题是:postgres中一个维度的数组的最大大小是多少?
so my question is: how many max size of array one dimmension in postgres?
谢谢:)
推荐答案
有无大小限制。行或列的大小必须有限制,但要在数百万个条目中运行。
There is no size limit on Postgres arrays. There must be limits on row or column size, but that would run in the millions of entries.
将术语与文档相关联的更多SQL方法是一对多关系。的实现方式如下:
A more SQL way to relate term to document is a 1 to many relation. This is implemented like:
table term: columns term_id, term, document_id
table document: columns document_id, summary, ...
b中的 document_id
列 term
表称为外键。
这篇关于PostgreSQL中数组类型的大小/长度限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!