Database Reference
In-Depth Information
STEP 3: INDEX AND SHARD
The primary and alternate keys from our logical data model are converted into unique in-
dexes on the physical. We can also add additional indexes for performance, called second-
ary or non-unique indexes. Partitioning (called “sharding” in MongoDB) is when a collec-
tion is split up into two or more parts. Vertical partitioning is when fields are split up, and
horizontal is when documents are split up.
On our model there are no immediately apparent opportunities to shard. However, we
did identify
surveyQuestionLabelName
,
surveyRespondentLastName
and
sur-
veyRespondentFirstName
as being queried frequently, so we added non-unique indexes
to each of these (Note that we added a composite index on both
surveyResponden-
tLastName
and
surveyRespondentFirstName
as they are frequently queried together):
STEP 4: REVIEW AND CONFIRM