Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

How do indexes actually work?

2 replies [Last post]
  • Login or register to post comments
Mon, 03/26/2012 - 09:00
tombrown52
Offline
Joined: 03/26/2012
Groups: None

I watched the webinars about views and indexes and I have a few questions I hope someone will answer.

Are indices updated whenever new documents are posted, or are they only updated when the view is requested? (If they're updated incrementally whenever new documents are posted, why can a query specify that the index should be rebuilt?)

What is the likely performance of an index over a database with 10 million objects? Is the expected return time likely to be within seconds? minutes? hours?

Does adding each index impact performance of PUT operations in a significant way?

Thanks in advance!

Top
  • Login or register to post comments
Mon, 03/26/2012 - 10:26
dipti
Offline
Joined: 11/02/2011
Groups:

Hi tombrown52

Indexes do not get built when new documents are posted/inserted but rather when the view is accessed. They are built incrementally after the first index build. Index building is triggered after a query accesses a view. This is subject to the "stale" argument that can be set at query time. (http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writi...). Starting DP4, the default for the "stale" argument is "update_after".

This section in the documentation provides more details on how views work: http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-datas...

Index performance dependents largely on the view definitions. If the view definitions are fairly complex or emit entire documents (bad practice), index building can take longer. The number of design documents you have also has an impact on system performance. Grouping similar views (that have a similar access pattern) into a single design document helps improve performance as all views in a design document are built together.

Hope this helps.

Top
  • Login or register to post comments
Mon, 03/26/2012 - 12:34
tombrown52
Offline
Joined: 03/26/2012
Groups: None

Thanks for the info!

Can you address the expected query time (will it take seconds, minutes, or hours to build/update an index)?

If an index is already being updated and another query (with stale=update_after) is sent, will the 2nd update queue up, or will it notice that an update is already happening and ignore the second one?

Also, at what point are expired records removed from a view? I understand that documents are expired lazily (only when retrieved), but does that apply to index creation as well? Will a document be removed from an index once the index is rebuilt after it's expiration time, or will it stay in the index until after I access it and then rebuild the index?

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker