Map reduce or GSI?

Hi,

I have a question about whether map reduce or GSI would be better.

Use case:

  • logs (frequently insert but seldom/rarely queried)
  • need to minimize memory usage where possible
  • query response does not need to be in milliseconds for this bucket
  • data latency may be acceptable depends on how slow the updates are…
  • queries will be similar to get me all documents that are “created” by a user for a particular “id” and/or for a particular “date”; additional attributes may also be used (e.g., about 3-6 different attributes)

If we create GSI, it will be for all document range (within the TTL). This document may utilize TTL, but the TTL can be quite large (e.g., many years potentially…). An index for the entire date range or by the user who created it, etc. Basically the 3-6 indexes might be large. It may be simplified with the use of a couple covering index instead.

As a result, I’m looking to see what would be a better approach for something that is insert many but query seldom/rare. Would map reduce be better?

Thank you.
Regards, Steve

FYI, you can also use N1QL with views. That would allows you to switch between views and GSI if needed. This is called CREATE INDEX … USING VIEW.

1 Like