Can N1QL query to stored index or create indexes?


We are working on an web analytics application and we were doing some medium level load test. At the time we are having 3-4 records, N1QL returns the answers very quickly.

However, as soon as we increased the number of documents from 4000 to 4,00,000, it is taking 25-30 seconds each time we make the query.

We are expecting 40 millions documents in a month when we go live and I believe it will be deadly slow if we try to run our analytics server over 40 millions documents.

Do we need to shift to Map-Reduce queries or can N1QL still be useful or do you any other suggestions for us?

Paras Mendiratta

Hi Paras,

Several points:

  • You should use the CREATE INDEX and EXPLAIN statements in N1QL to ensure that all your queries are using indexes.

  • N1QL currently uses map-reduce views as its indexes, and so N1QL’s performance is gated by the performance of the map-reduce views.

  • N1QL is currently in Developer Preview and is not yet suitable for production use. The previews are only for previewing the functionality and do not contain any performance tuning. Performance tuning will come in a Beta release of N1QL. For immediate production use, you should directly use the map-reduce views.

Please post any further questions you have.