7

In my the Magento2-0.74.0-beta7 there are some tables related to sales entities that start with sequence_.

  • sequence_creditmemo_0
  • sequence_creditmemo_1
  • sequence_invoice_0
  • sequence_invoice_1
  • sequence_order_0
  • sequence_order_1
  • sequence_shipment_0
  • sequence_shipment_1

All these tables contain a single column sequence_value

I assume that 0 and 1 at the end of the table name are related to the store id, but what's the purpose of the tables?

2 Answers 2

7

I happened to notice this table.

In case you're still interested, it records the increment_id for order/invoice/shipment of your store.

e.g. Place a new order, it increases by 1.

Set it to 1000000, your next order id will be 1000001.

4
  • 1
    Oh. I've forgot about this. Yes I'm still interested since I haven't found an answer yet. I will check and get back to you.
    – Marius
    Apr 6, 2016 at 10:52
  • 2
    Yep. It seams that's what it does. It holds the last increment id without the prefix.
    – Marius
    Apr 6, 2016 at 10:55
  • 2
    Magento 1 developers can relate this to eav_entity_store.increment_last_id
    – benmarks
    Aug 23, 2017 at 13:30
  • I think it records the entity_id. The value of increment_id can be different than the value of the sequence id Aug 27, 2021 at 7:49
1

I am pretty sure it's to improve concurrency. I think it goes faster than using MySQL auto allocation. Eg you can grab 100 ids in a single update for batch loads. Or preallocate an id before inserting the real record etc.

1
  • 1
    OK. But what do they store? Or what code uses those tables?
    – Marius
    May 5, 2015 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.