Note that there are some explanatory texts on larger screens.

plurals
  1. POmulti-shop orders table and sequential order numbers based on shop
    primarykey
    data
    text
    <p>I am looking at building a shop solution that needs to be scalable. Currently it retrieves 1-2000 orders on average per day across multiple country based shops (e.g. uk, us, de, dk, es etc.) but this order could be 10x this amount in two years.</p> <p>I am looking at either using separate country-shop databases to store the orders tables, or looking to combine all into one order table.</p> <p>If all orders exist in one table with a global ID (auto num) and country ID (e.g uk,de,dk etc.), each countries orders would also need to have sequential ordering. So in essence, we'd have to have a global ID and a country order ID, with the country order ID being sequential for countries only, e.g. </p> <p>global ID = 1000, country = UK, country order ID = 1000<br> global ID = 1001, country = DE, country order ID = 1000<br> global ID = 1002, country = DE, country order ID = 1001<br> global ID = 1003, country = DE, country order ID = 1002<br> global ID = 1004, country = UK, country order ID = 1001 </p> <p>THe global ID would be DB generated and not something I would need to worry about. But I am thinking that I'd have to do a query to get the current country order based ID+1 to find the next sequential number. Two things concern me about this: 1) query times when the table has potentially millions of rows of data and I'm doing a read before a write, 2) the potential for ID number clashes due to simultaneous writes/reads.</p> <p>With a MyISAM table the entire table could be locked whilst the last country order + 1 is retrieved, to prevent ID number clashes. </p> <p>I am wondering if anyone knows of a more elegant solution?</p> <p>Cheers, imanc</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload