tags:

views:

72

answers:

2

Hey here is an example:

CREATE SEQUENCE S1
START WITH 100
INCREMENT BY 10
CACHE 10000000000000000000000000000000000000000000000000000000000000000000000000

If i fire a query with such a big size even if it creates the sequence s1. What is the max size that I can provide with it???

A: 

Looking in the Oracle API, I don't see a maximum cache size specified (Reference).

Here are some guidelines on setting an optimal cache size.

pianoman
Your links are about others caches, not the sequnce cache, most people use 20 as the seqeunce cache number.
Theo
Is there a maximum specified in any Oracle documentation? Couldn't find one...
pianoman
+2  A: 

http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_6015.htm#SQLRF01314

Quote from 11g docs ...

Specify how many values of the sequence the database preallocates and keeps in memory for faster access. This integer value can have 28 or fewer digits. The minimum value for this parameter is 2. For sequences that cycle, this value must be less than the number of values in the cycle. You cannot cache more values than will fit in a given cycle of sequence numbers. Therefore, the maximum value allowed for CACHE must be less than the value determined by the following formula: (CEIL (MAXVALUE - MINVALUE)) / ABS (INCREMENT)

If a system failure occurs, then all cached sequence values that have not been used in committed DML statements are lost. The potential number of lost values is equal to the value of the CACHE parameter.

Determining the optimal value is a matter of determining the rate at which you will generate new values, and thus the frequency with which recursive SQL will have to be executed to update the sequence record in the data disctionanry. Typically it's higher for RAC systems to avoid contention, but then they are also generally busier as well. Performance problems relating to insufficient sequence cache are generally easy to sport through AWR/Statspack and other diagnostic tools.

David Aldridge