读取和写入操作数组与 Postgres 中的多行

Read and write operations Array vs multiple rows in Postgres

如果我想针对同一 ID 多次存储 10k(有时更少或更多)字符串值,我应该使用数组来存储这些字符串值还是应该针对同一 ID 一个接一个地插入这些字符串值.

您可以同时执行这两项操作,但只需查看从文档中摘录的提示

Tip: Arrays are not sets; searching for specific array elements can be a sign of database misdesign. Consider using a separate table with a row for each item that would be an array element. This will be easier to search, and is likely to scale better for a large number of elements.

https://www.postgresql.org/docs/current/arrays.html

所以我更喜欢存储多行。