Effects of sequence caching
In the following example, assume that sequence
seq has
the default type of 64-bit integer, and each SPU has its own cache
of 100,000 values. The select statement retrieves emp table
rows, where emp is distributed across several data
slices. For each row, the nextval sequence number
is obtained from the cache on the host or SPU. The output shows how
the nextval numbers can differ depending on which
SPU contained the rows of the table, and how there are typically gaps
between the sequence numbers.dev.schema(admin)=> SELECT *, next value for seq FROM emp;
id | name | grp | nextval
---+-------------+--------------+---------
4 | John | mkt | 49
8 | Jim K | sdev | 52
12 | Jane | adm | 54
1 | Julie | dev | 310079
5 | Jackie | hdev | 310080
9 | Mike | hdev | 310088
13 | Jill | adm | 310114
2 | Tom | adm | 198235
6 | Dan | sdev | 198312
10 | Craig | sdev | 198331
14 | Judy | sdev | 199010
3 | Chuck | sdev | 243522
7 | Dave | sdev | 256673
11 | David | sdev | 262004