loading...

How does database indexing of Arrays work?

patarapolw profile image Pacharapol Withayasakpunt ・1 min read

This is without doubt, one of the reasons I chose NoSQL, e.g. MongoDB; but can it apply to RDBMS? Will it be simple / intuitive to maintain?

Usually one-to-many relationships, right? But I believe, 1. no relationship might be faster than one relationship; 2. what about maintenance and readability?

This only apply to easily indexable arrays, like Number or String, though.

Discussion

markdown guide
 

Not clear what you mean by this. Are you asking how arrays as column values in relational databases are indexed? I think it depends on the specific relational database and what types of queries it supports on array values.

 

I think the answer is usually one-to-many relationships.

However, I am not sure if JSON or JSONB columns in PostGRES can be indexed. (That is, no Foreign keys needed.)

 

The answer for MongoDB is discussed in this link.

qr.ae/pNsEOb