Forum: Building VoltDB Applications

Post: retrieving only changes

retrieving only changes
yiannis
Mar 1, 2015
Hi,

Is there any way to retrieve only the changes between executions of the same select query?


since there can be so many queries I suppose VoltDB can't do that by default for all queries. Thus it would have to look up on the transaction log to get this information?

1. thus, there should be a method build an index of the changes for a specific query by asking manually voltdb to do so at the time of the select query, so that when it is executed the next time it will return only the changes?

2. and to avoid asking VoltDB manually at each time to do (1), maybe there could be a way to build a <VIEW> with an extra description so that VoltDB knows that it should automatically store/update such index whenever the <VIEW> is queried? and thus by doing something like 'select changes since ...'


thanks
bballard
Mar 2, 2015
Hi Yiannis,

Supposing the query is a GROUP BY query, and you want to aggregate at regular intervals, you can use a VIEW to make this very efficient. Any regular interval can be made by leveraging functions such as TRUNCATE and arithmetic.

However, if the query is not a GROUP BY or if you want it to reflect changes "between executions" which may not be at regular intervals, then a VIEW probably wouldn't help. You would need to devise a way to store the timestamp of the last execution in the database so it could be queried, such as creating a table for this purpose. Then you would want to have an index on the main table you are querying that begins with the TIMESTAMP as the first column, and might have additional columns if that would help with executing the rest of the query.

I hope this helps,
Ben