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

Specify Field Selection #74

Open
sabrehagen opened this issue Mar 28, 2017 · 3 comments
Open

Specify Field Selection #74

sabrehagen opened this issue Mar 28, 2017 · 3 comments

Comments

@sabrehagen
Copy link

Hi,

Mongoose supports the ability to select specific fields when querying the database via the query.select('document fields to select') syntax. This helps when serialization becomes a bottleneck. For example, when datasets get large and only a small fraction of each document is required (e.g. 1/10th) from the database, reading the entire document can be an unnecessary cost.

I have not looked into the source of linvodb. Would it be an optimization for for linvodb to implement a select option for queries, or would this provide no performance improvement? Currently I return all documents matching a query, then map over them to extract the fields I need before returning the result. The select option would save this extra map stage, and potentially save extracting a large amount of data not needed by the user.

Thoughts?

@Ivshti
Copy link
Owner

Ivshti commented Mar 28, 2017

the way linvodb3 works is that it takes the objects out of any underlying storage and then JSON.parse-es them

this means that even if you want a subset of fields the whole object would still have to be retrieved and then parsed, which defeats the performance benefits

I suggest you utilize live queries and aggregation, that way the objects will be really retrieved only once at the loading of the app and afterwards the results will only be hot-updated when necessary

@Ivshti
Copy link
Owner

Ivshti commented Mar 28, 2017

Also if you are running into performance issues you should try changing your back-end store. What are you using at the moment?

@sabrehagen
Copy link
Author

Currently leveldown holding 10,000 documents ~250 chars each.

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