Which is better: single global sequence vs. sequence per table? Which is better: single global sequence vs. sequence per table? oracle oracle

Which is better: single global sequence vs. sequence per table?


Although cacheing alleviates it, a sequence can cause contention when multiple sessions require nextvals.If you have one sequence serving all tables then all inserts on all tables will contend for the same sequence. If you are after performance, one sequence for each table will give less contention.


A single sequence means no matching ids in two tables. In practice I like this because you can never get something when you accidentally query the wrong table. Particularly useful with deletes. It is a little thing but I find it useful.


I would recommend you use a sequence per table. It is just a little cleaner in my book. The standard at my current placement of employment is sequence per table.