Details
-
Improvement
-
Resolution: Done
-
Major
-
4.0.0
Description
Most SQL engines have a feature called sequences or serials - an atomic counter which is incremented every time it is accessed.
This is used widely for the generation of keys.
Our KV supports a special time of counter documents which can be incremented atomically.
In order to facilitate migration of relational applications to N1QL we should take advantage of the KV counters and create a similar facility as sequences - with DDL and suitable functions to increment and query the sequence values.
As a possible suggestion, somewhat mimicking Oracle:
CREATE SEQUENCE sequenceName IN keyspace WITH (<sequence specs>)
ALTER SEQUENCE keyspace.sequenceName TO (<sequence specs>)
DROP SEQUENCE keyspace.sequenceName
nextval(keyspace.sequenceName) -> Now SQL standard: NEXT VALUE FOR ...
currval(keyspace.sequenceName) -> Now: PREV VALUE FOR ...
Attachments
Issue Links
For Gerrit Dashboard: MB-22424 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
179864,72 | MB-22424 Add sequences to scopes | master | query | Status: MERGED | +2 | +1 |
194340,6 | MB-22424 Add sub-doc mutation support | master | gomemcached | Status: MERGED | +2 | +1 |
194520,4 | MB-22424 Query interface changes | master | n1fty | Status: MERGED | +2 | +1 |
195582,2 | MB-22424 Sequences | unstable | eventing | Status: MERGED | +2 | +1 |
195583,2 | MB-22424 Sequences | unstable | eventing-ee | Status: MERGED | +2 | +1 |
199591,13 | MB-22424: sequence test cases | master | testrunner | Status: MERGED | +2 | +1 |