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

Query performance, v4 vs v5 vs v4->v5 #2023

Closed
PeterThornton4Ing opened this issue Jul 6, 2021 · 7 comments
Closed

Query performance, v4 vs v5 vs v4->v5 #2023

PeterThornton4Ing opened this issue Jul 6, 2021 · 7 comments

Comments

@PeterThornton4Ing
Copy link

PeterThornton4Ing commented Jul 6, 2021

Im seeing some really strange Query performance problems after updating to version 5:

The context is 1.5 million simple POCO objects "Item" in a collection.
The Item has a bool property "ShowInSys"
There is a related index _db.GetCollection().EnsureIndex(i => i.ShowInSys);

We query for items like this: _db.GetCollection().Find(i => i.ShowInSys)
This returns about 50 items (of the 1.5 million total)

When doing the above query in version 4.1.4 the query takes 68ms.

When upgrading an existing v4 database to v5 and doing the query it takes 68ms

When creating a new v5 database (and inserting the 1.5 mil items) the query takes 38000ms

Maybe im missing something here, but this makes no sense to me. Could someone shed some light on what is going on here?
Why in the world is a "fresh" v5 so much slower than an updated v4?

Edit: Running the same query "SELECT $ FROM Item where $.ShowIn= true" from LiteDb Studio exchibits the same problems when doing if on a upgraded v4->5 vs a clean v5 database.,

@PeterThornton4Ing PeterThornton4Ing changed the title Query performance, v4 vs v4 vs v4->v5 Query performance, v4 vs v5 vs v4->v5 Jul 6, 2021
@lbnascimento
Copy link
Contributor

@PeterThornton4Ing Could you send me your datafiles? You can send them to me at lbnascimento@inf.ufrgs.br

@PeterThornton4Ing
Copy link
Author

@PeterThornton4Ing Could you send me your datafiles? You can send them to me at lbnascimento@inf.ufrgs.br

Will do :-)

@lbnascimento
Copy link
Contributor

There was a bug where indexes over bool fields were being created with an incorrect expression, so the query optimizer was not finding them. The fix for it is to open the affected datafile with the latest master of LiteDB, dropping all of the bool indexes and recreating them.

@PeterThornton4Ing Given that you have an unaffected version of your datafile, you may simply keep using them.

@PeterThornton4Ing
Copy link
Author

Excellent! Thank you very much.
Any ETA on a new release?

@lbnascimento
Copy link
Contributor

@PeterThornton4Ing It has been released.

@PeterThornton4Ing
Copy link
Author

@PeterThornton4Ing It has been released.

Excellent. I see the new build, but the NuGet package is still version 5.0.10 any ETA on an updated NuGet package?

@lbnascimento
Copy link
Contributor

@PeterThornton4Ing It should be out now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants