Generating sequential numbers in multi-user saas application

后端 未结 6 1801
野趣味
野趣味 2021-02-08 20:52

How do people generate auto_incrementing integers for a particular user in a typical saas application?

For example, the invoice numbers for all the invoices for a partic

6条回答
  •  日久生厌
    2021-02-08 21:32

    You could introduce another table associated with your "users" table that tracks the most recent invoice number for a user. However, reading this value will result in a database query, so you might as well just get a count of the user's invoices and add one, as you suggested. Either way, it's a database hit.

提交回复
热议问题