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

array index in 4.3 #1051

Open
catapop84 opened this issue Sep 29, 2024 · 1 comment
Open

array index in 4.3 #1051

catapop84 opened this issue Sep 29, 2024 · 1 comment

Comments

@catapop84
Copy link

Just tested your database to see if it's suited to be embedded in our app.
We have a collection of users and each user can have one or more email addresses. So we created a field emails as an array of strings

We did a search without index on emails field and with index on emails field and the duration is roughly the same around 170-180ms for a 15k+ documents collection.

Does array index really work because I didn't saw any speed improvements with or without index. Tested also unique vs non unique index and the same result.

If we create a field email of type string (not array) the index works: 30-40ms with index vs 180-190ms without index.

Tested in java , version 4.3 with rocksdb module.
The code we did the test is

        long start = System.nanoTime();
        collection.find(where("emails").elemMatch($.eq("[email protected]"))).forEach(System.out::println);
        long end = System.nanoTime();
        Log.info("Time taken: {} ms", (end - start) / 1_000_000);
@anidotnet
Copy link
Contributor

I'll take a look at it.

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