Support Questions
Find answers, ask questions, and share your expertise

Why does Apache Phoenix sequence not start from 1.

Explorer

I have an apache phoenix sequence field which is defind as:

CREATE SEQUENCE ID.COUNT;

When i insert data by sqlline.py, then, the COUNT start from 1.

if i insert data by JDBC template, the COUNT will start from 101, 201. It automatically append 01 at the end of the COUNT.

How can i fix this issue?

1 REPLY 1

Super Guru

@Bin Ye

I can only guess here but 100 sequence numbers are cached by client. S, if you run "sqlline.py" first, it will cache 100 sequences and a new client will start from next sequence which is 101. This is what is likely going on. The only other explanation is that your CREATE SEQUENCE statement conatins "STARTS WITH 101" which I think it doesn't.

Change the following value to 50 and see if your jdbc value starts with 51?

https://phoenix.apache.org/sequences.html

; ;