2

If I want to store 10k (sometimes less or more) string values against the same ID multiple times, should I use an array to store those string values or should I insert those string values one by one against the same ID.

1 Answer 1

4

You can do both but just have a look to this tips extract from the doc

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

So I should prefer to store muliple rows.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.