Alter Sequence

Moderator: NorbertKrupa

Post Reply
samuel_mahanty
Newbie
Newbie
Posts: 5
Joined: Thu Mar 26, 2015 4:45 pm

Alter Sequence

Post by samuel_mahanty » Thu Mar 26, 2015 4:59 pm

Hi,

I need to modify the value for the column session_cache_count for some of the sequences .
I tried to execute the following script -
ALTER SEQUENCE <<SEQUENCE_NAME>> SET session_cache_count = 1;
while doing so I am getting the below error -

[--SELECT - 0 row(s), 0.000 secs] [Error Code: 4856, SQL State: 42601] [Vertica][VJDBC](4856) ERROR: Syntax error at or near "session_cache_count"
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]


Can you let me know the correct syntax to change the value.

Regards,
Samuel
Regards,
Samuel

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: Alter Sequence

Post by JimKnicely » Thu Mar 26, 2015 8:01 pm

I do not think you can change the value of session_cache_count. It is just a reflection of the cache value.

Code: Select all

dbadmin=> CREATE SEQUENCE jim CACHE 10;
CREATE SEQUENCE

dbadmin=> SELECT session_cache_count FROM sequences WHERE sequence_name = 'jim';
 session_cache_count
---------------------
                  10
(1 row)

dbadmin=> ALTER SEQUENCE jim CACHE 20;
ALTER SEQUENCE

dbadmin=> SELECT session_cache_count FROM sequences WHERE sequence_name = 'jim';
 session_cache_count
---------------------
                  20
(1 row)
By the way, I wouldn't use a CACHE size of 1 as you will get terrible performance from it... The minimum I would use is 500. But if you are inserting millions of rows, I'd leave it at 250,000 (the default).
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

samuel_mahanty
Newbie
Newbie
Posts: 5
Joined: Thu Mar 26, 2015 4:45 pm

Re: Alter Sequence

Post by samuel_mahanty » Thu Mar 26, 2015 9:09 pm

Thanks knicely87.
Got it done as suggested by you.
Regards,
Samuel

Post Reply

Return to “New to Vertica Database Administration”