Number sequences handle automatic allocation of voucher numbers, invoice numbers, and journal numbers used by Microsoft Dynamics AX. You can set the allocation to be Continuous, or Preallocate a block of numbers. When using Continuous, gaps are not allowed, so a trip to the database is needed to get the next number. When preallocating, a block of numbers are stored in memory, thus reducing the number of trips. This is important for the overall performance of the system; however, it is important to understand how these numbers are cached in a multi-user system.
Number sequences are stored on the client and not shared among user sessions, thus, each client/user session draws its own set of numbers. If the client/user session logs out, then a new set of numbers are pulled, but if they stayed logged in they will continue to use the first set of numbers that were allocated to that client/user session. For example:
- Sales orders are set to preallocate by 10 and the next number is SO-00010
- User A launches a client session and attempts to create Sales orders
- The system preallocates 10 numbers in memory (SO-00010-SO-00019)
- User A creates three Sales orders and the system creates them as SO-00010, SO-00011, SO-00012
- User B launches a client session and attempts to create Sales orders
- The system preallocates 10 numbers in memory (SO-00020-SO-00029)
- User B creates one Sales order and the system creates this as SO-00020
- User A creates another Sales order and the system creates as SO-00013
- User A logs out of its client session
- User A launches a new client session and attempts to create Sales orders
- The system preallocates 10 numbers in memory (SO-00030-SO-00039)
- User A creates one Sales order and the sytem creates it as SO-00030
In most cases, using preallocated number sequences is good practice of less trips to the database, but if the risk of using too many number sequences is not a good trade off for increased performance then you should reconsider.