DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

1 1

How does database indexing of Arrays work?

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.

Top comments (3)

Collapse
 
camdenclark profile image
Camden Clark

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.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

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.)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

The answer for MongoDB is discussed in this link.

qr.ae/pNsEOb

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay