These are chat archives for Automattic/mongoose

21st
Dec 2016
Paul "Joey" Clark
@joeytwiddle
Dec 21 2016 07:55

@eliecerthoms If you sometimes query by category and sometimes query by slug then it sounds reasonable to index them both.

I suspect the cost of using 5 indexes is about 5 times the cost of using one index, when saving a document. In other words it’s a linear relationship, so indexing multiple fields is not really dangerous.

eliecerthoms
@eliecerthoms
Dec 21 2016 07:57
@joeytwiddle Thanks! It is a blog, so the number of documents stored will not be that large either. Images will only be linked as well so the docs will hopefully not be so heavy.
Paul "Joey" Clark
@joeytwiddle
Dec 21 2016 07:58
In that case, you might not need to index at all ;)
eliecerthoms
@eliecerthoms
Dec 21 2016 07:58
at what number of documents is an index necessary?
@joeytwiddle
Paul "Joey" Clark
@joeytwiddle
Dec 21 2016 08:00
I would guess > 500. Might depend on the power of your server.
Actually I don’t know if the size of the other fields is relevant. Presumably your content field might be quite large.
But yeah anyway go for indexing, it sounds like it will be harmless. :)
eliecerthoms
@eliecerthoms
Dec 21 2016 08:00
haha!