Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1112435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:42:33+00:00 2026-05-17T02:42:33+00:00

I am looking at building a shop solution that needs to be scalable. Currently

  • 0

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.

I am looking at either using separate country-shop databases to store the orders tables, or looking to combine all into one order table.

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.

global ID = 1000, country = UK, country order ID = 1000
global ID = 1001, country = DE, country order ID = 1000
global ID = 1002, country = DE, country order ID = 1001
global ID = 1003, country = DE, country order ID = 1002
global ID = 1004, country = UK, country order ID = 1001

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.

With a MyISAM table the entire table could be locked whilst the last country order + 1 is retrieved, to prevent ID number clashes.

I am wondering if anyone knows of a more elegant solution?

Cheers,
imanc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:42:34+00:00Added an answer on May 17, 2026 at 2:42 am

    There is a way of doing this.

    INSERT INTO test123 (`Country`, `Country order code`)
    SELECT 'UK', MAX(`Country order code`) + 1
    FROM test123
    WHERE `Country` = 'UK'
    

    This puts a new order for the UK in, it selects the highest order code an adds one.
    This has been tested, and all that needs to be changed is the names of the tables and fields

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking at building a simple web app that will expose an API that
When looking beyond the RAD (drag-drop and configure) way of building user interfaces that
We are a small Microsoft shop looking into ExtJs and like the rapid building
I am looking into building a smallish Java rpg. I haven't found any good
I'm looking into building a content site with possibly thousands of different entries, accessible
I'm looking at building basic CMS functionality into our web product and am researching
I'm looking at building a Rails application which will have some pretty large tables
I'm looking at building some web user controls with an eye toward re-use, but
I'm looking at building an API and was considering oauth for managing access to
I am looking into building an authentication in my ASP.NET application with the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.