You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for sampled querying based on user-defined time/error constraints #1344
One way to improve a database's performance is to reduce the volume of data that is being read and processed at all for a particular query. A way of doing this is to allow the user to specify the required statistical boundaries for the results, and use the smallest sample possible for answering the query.
Although this is a long shot and probably would need a lot of refactoring, it would still be nice if this sort of think would become possible in the future. I guess syntax could be something like r.db('foo').table('transactions').filter({category: "Vegetables"}).groupBy('product', r.avg).bounded({time: 2, confidence: 0.95, error: 0.1})
We don't have a timeout command, but for the error, confidence, you can use the sample command.
To get a constraint (like error 0.1, confidence 0.95), you would have to do a count query, compute the good parameter for sample and then run your map/reduce.
Using it with groupBy is however not possible (or at least I can't think of an efficient way of doing it).
It's certainly not as friendly as giving an error and a constraint. I leave @coffeemug chime in for an ETA, but that's probably not going to happen before 2.0 even if it's quite a cool feature.
@neumino I believe BlinkDB does more sophisticated things than just create shortcuts for sampling. In particular, they have implemented automatic generation and caching of relevant samples (which is where their performance comes from).
Yes, their core is about providing estimates, so things are optimized for that. From what I read (I haven't read a lot, so I may be wrong), but they keep some samples in memory that they periodically adjust.
I am not sure RethinkDB will keep some samples in memory, not that because it's impossible or hard to do, but because I would tend to think of estimates as an edge case.
Typically, if you are a social network, you cannot compute the number of friends of someone just based on a sample because the data is too skewed.
Incremental map/reduce (#1118) and triggers (#997) can probably be an efficient solution/workaround to compute estimates.
Moving to backlog, since this won't happen until 2.0. This is a really neat idea (@mglukhovsky and I looked at BlinkDB and though, man, it would be cool if Rethink could do that!) But our primary goal now is to have an amazing database for people building realtime applications, not to have an analytics database (though I do realize the lines can get blurry).
We'll probably go back to this once we run out of low-hanging fruit.
Activity
neumino commentedon Aug 22, 2013
We don't have a timeout command, but for the error, confidence, you can use the
samplecommand.To get a constraint (like error 0.1, confidence 0.95), you would have to do a
countquery, compute the good parameter forsampleand then run your map/reduce.Using it with groupBy is however not possible (or at least I can't think of an efficient way of doing it).
It's certainly not as friendly as giving an error and a constraint. I leave @coffeemug chime in for an ETA, but that's probably not going to happen before 2.0 even if it's quite a cool feature.
pixelspark commentedon Aug 22, 2013
@neumino I believe BlinkDB does more sophisticated things than just create shortcuts for sampling. In particular, they have implemented automatic generation and caching of relevant samples (which is where their performance comes from).
neumino commentedon Aug 22, 2013
Yes, their core is about providing estimates, so things are optimized for that. From what I read (I haven't read a lot, so I may be wrong), but they keep some samples in memory that they periodically adjust.
I am not sure RethinkDB will keep some samples in memory, not that because it's impossible or hard to do, but because I would tend to think of estimates as an edge case.
Typically, if you are a social network, you cannot compute the number of friends of someone just based on a sample because the data is too skewed.
Incremental map/reduce (#1118) and triggers (#997) can probably be an efficient solution/workaround to compute estimates.
coffeemug commentedon Aug 27, 2013
Moving to backlog, since this won't happen until 2.0. This is a really neat idea (@mglukhovsky and I looked at BlinkDB and though, man, it would be cool if Rethink could do that!) But our primary goal now is to have an amazing database for people building realtime applications, not to have an analytics database (though I do realize the lines can get blurry).
We'll probably go back to this once we run out of low-hanging fruit.