Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range searches do not use available index #20

Open
edwardcoolson opened this issue Nov 27, 2014 · 5 comments
Open

Range searches do not use available index #20

edwardcoolson opened this issue Nov 27, 2014 · 5 comments

Comments

@edwardcoolson
Copy link

Range searches perform slow even if the index is created for those searches. I tried range query using the example code from Indices & Performance doc chapter:

var db = new ForerunnerDB(),
    names = ['Jim', 'Bob', 'Bill', 'Max', 'Jane', 'Kim', 'Sally', 'Sam'],
    collection = db.collection('test'),
    tempName,
    tempAge,
    i;

for (i = 0; i < 100000; i++) {
    tempName = names[Math.ceil(Math.random() * names.length) - 1];
    tempAge = Math.ceil(Math.random() * 100);

    collection.insert({
        name: tempName,
        age: tempAge
    });
}

collection.ensureIndex({
  age: 1
});

var explained = collection.explain({
  age: {
    '$gte': 30,
    '$lte': 40
  }
});

'Explained' object has tableScan: 100000 as if no index is used.

@Irrelon
Copy link
Owner

Irrelon commented Nov 27, 2014

I'll take a look. Range searches may not be index aware right now but it should be a simple fix. :)

@edwardcoolson
Copy link
Author

Thank you Rob. Will be waiting for improvements.

@olegabr
Copy link

olegabr commented Dec 18, 2014

hi, @Irrelon! any progress with that?

@olegabr
Copy link

olegabr commented Dec 23, 2014

It is a critical feature for me. I've tried to dig into the code in a hope to implement it by myself, but it is not easy. The key is the Path concept used everywhere in the code. For now I choosed to abandon the forerunnerdb in a favor of mongodb that supports such a feature. Yes it doesn't work in a browser and it constrains me a lot, but better have something on the server side only, instead of having nothing everywere ;-(

@Irrelon
Copy link
Owner

Irrelon commented Dec 23, 2014

Hi @olegabr,

This fix is on the roadmap for 1.4.0. The paths system isn't likely to require changes, only the way the indexes are detected against the query and the code that can understand how to query that index based on a range search.

Also please note that ForerunnerDB is still young and enhancements are being made regularly! :) It is not meant to replace MongoDB but rather compliment it so it's good you are using Mongo 👍

Irrelon added a commit that referenced this issue Mar 3, 2015
@Irrelon Irrelon changed the title Slow range searches. Available index is not used Range searches do not use available index Mar 9, 2016
@Irrelon Irrelon self-assigned this Mar 9, 2016
@Irrelon Irrelon added this to the Version 2.0.0 milestone May 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants