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

  • SEARCH
  • Home
  • 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 3604470
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:00:06+00:00 2026-05-18T21:00:06+00:00

In a stock control system, which records the following entities in the database (this

  • 0

In a stock control system, which records the following entities in the database (this is over simplified of course):

  • Items (for which the stock needs to be controlled)
  • Stock movements:
    • Input movements (they add up to certain item stock)
    • Output movements (they substract from certain item stock)

Which is the best strategy and why:

  • Store the current quantity for each item and update it every time a movement is recorded.
  • Don’t store the current quantity in each item and calculate it every time is needed as item.current_qty = sum(item.input_movements.qty) - sum(item.output_movements.qty (this is no particular language, it’s just pseudo code)

Take into account that, being a stock control system, the current quantity for each item is used a lot.

Note: this question is similar to this other, but this one is especially about data that can be aggregated.

  • 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-18T21:00:07+00:00Added an answer on May 18, 2026 at 9:00 pm

    Option B is the Normalized one.
    I have done it that way in an ERP that I made for a client, using Access as the front-end, and SQL Server as the back-end. To date there are about 250.000 movements and it’s still snappy.

    I think it depends a bit on your volumes and which db engine you are using. If it is Access for example, there are no triggers and I would not rely on the front end logic. On SQL Server you could denormalize and have the quantity on hand recalculated at every movement, plus eventually make recalcs when problems arise.

    The best way to go for me: see the excellent analysis of the question by Allen Browne available here.

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

Sidebar

Related Questions

When designing a stock management database system for sales and purchases what would be
So I have a control which, in response to its items being changed, calls
the following code is for user control(it display banner), the page get stuck in
I'm Downloading stock prices from Yahoo for the S&P500, which has volume too big
I've got a custom control which has a DependencyProperty MyAnimal - I'm binding an
How do I create an event on my custom asp.net control which can bubble
I need to implemente a Java class which uses JNI to control a fiscal
I'm developing CMS application in C#(4.0 Framework) which connects to MySQL database (5.0.95) on
I have created a custom TextBox control which also contains a RequiredFieldValidator. Everything works
I'm getting the following exception while redrawing my DataGridView control: Unhandled exception : Odwołanie

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.