# Increase the concurrency of sequences

If you use a sequence generator (created with the CREATE SEQUENCE statement), you can increase its concurrency by doing the following.

- Do not query the SYSSEQUENCES system table directly. Instead, use the SYSCS_UTIL.SYSCS_PEEK_AT_SEQUENCE system function to obtain the current value of a sequence generator.
- Specifying a higher value for the derby.language.sequence.preallocator property may increase your concurrency. However, you should pay special attention to bringing down the database in an orderly fashion so as not to leak unused preallocated values. (See also Shut down the system properly.)

See the Derby Reference Manual for more information about the CREATE SEQUENCE statement, the SYSSEQUENCES system table, the SYSCS_UTIL.SYSCS_PEEK_AT_SEQUENCE system function, and the derby.language.sequence.preallocator property.

Parent topic: Performance tips and tricks
Related concepts
Use prepared statements with substitution parameters
Create indexes, and make sure they are being used
Ensure that table statistics are accurate
Increase the size of the data page cache
Tune the size of database pages
Avoid expensive queries
Use the appropriate getXXX and setXXX methods for the type
Tune database booting/class loading
Avoid inserts in autocommit mode if possible
Improve the performance of table functions
Configure Derby to use an in-memory database
Shut down the system properly
Put Derby first in your classpath