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 9130845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:02:22+00:00 2026-06-17T08:02:22+00:00

Since I don’t know to calculate efficiency I’ll ask here and I hope someone

  • 0

Since I don’t know to calculate efficiency I’ll ask here and I hope someone could tell me what is better and explain it a bit.

The scenario:
Currently I have a table that insert rows of production of each worker.
Something like: (Worker1) produced (product10) with (some amount) for a Date.
And that goes for each station he worked in though the day.

The Question:
I need to generate a report of the sum of amounts that worker produced for each date. I know how to generate the report either way but the question is how is it more efficient?

Having to run a query for each person that sums up the production for each date? or having a table that I’ll insert the total amount, workerID and date?

Again if you could explain it a bit further it would be nice, if not than at least an educated answer would help me a lot with this problem.

Example:
This is what I have right now in my production table:

ID     EmpID     ProductID     Amount     Dateofproduction
----------------------------------------------------------
1      1         1             100        14/01/2013  
2      1         2             20         14/01/2012

This is what I want in the end:

EmpID    Amount    DateofProduction
-----------------------------------
1        120       14/01/2013

Should I start another table for this? or should I just sum what I have in the production table and take what I need?
Bear in mind that the production table will get larger and larger each day (of course).

  • 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-06-17T08:02:24+00:00Added an answer on June 17, 2026 at 8:02 am

    i) Direct :

    select EmpId, sum(Amount) as Amount, DateOfProduction 
    from ProductionTable
    group by EmpId, DateOfProduction.
    

    ii) Now, the size of the table will keep growing. And you need only day-wise reports.

    Is this table being used by anyone else? Can some of the data be archived? If some of the data can be archived, I would suggest, after each day and reporting, backup all the data from this table to a secondary archive table. So, every day you will have to query only today's worth of records.

    Secondly, you can consider adding an index to DateOfProduction. You will then be able to restrict your queries in date range. For example, select EmpId, sum(Amount) as Amount, DateOfProduction from ProductionTable group by EmpId, DateOfProduction where DateOfProduction = Date(now()). (or something similar)

    Because it is just a single table and no complicated queries, MySql will be easily able to take care of millions of records. Try EXPLAIN on the queries to check the number of records being touched and indexes being used.

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

Sidebar

Related Questions

I'm not exactly sure what question to ask here since I don't know the
Since I don't quite know the language of these types of algorithms (i.e. how
I don't know how php.ini was configured since I don't have access to it.
I'm reading this code sample : And since I don't know C#, I decided
Since I have no errors I don't know if this is the right place
Maybe it's a strange question since I don't wanna know 'how' but 'why', but
(I've put ...to Entities in brackets since I don't know if this matters at
I want to add some features to webdriver , but since I don't know
I'm looking for dynamically growing vectors in Python, since I don't know their length
Short question since I don't know how to search for this. Can I re-update

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.