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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:57:43+00:00 2026-05-21T03:57:43+00:00

I am building an ecommerce CMS, in the admin section I want to display

  • 0

I am building an ecommerce CMS, in the admin section I want to display the total number of orders made, total earnings from said orders, and also display the totals from each category individually.

I can do this by querying various tables and counting up the sums, but would this be a better way:

Instead I am thinking of having a table that looks like this (and has just one record):

id | total_orders | total_earnings | toy_cat_sales | apparel_cat_sales | etc...
--------------------------------------------------------------------------------
1  | 10           | 10034          | 4             | 6                 | etc...

Now every time a purchase is made I can have this record be updated, for example when a new toy order is made I can update the toy_cat_sales column and also the total_orders and total_earnings columns to reflect the new purchase.

During the actual looking up process, querying this one table and just displaying it’s values would obvisly be much faster than performing counts and calculations on multiple tables with possibly tens of thousands of records.

But is this approach worth it overall? I do know that there will be just one admin and many customers. Orders will take place a lot more too as compared to the admin checking these stats in the back end. So the updates will take place a lot more than the lookups on the admin side if the 2nd approach is implemented.

I’m no MySQL expert so what would the experts here do, and I will just go with that.

  • 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-21T03:57:44+00:00Added an answer on May 21, 2026 at 3:57 am

    The problem you run into with this approach is that you have to add a new column to that table every time a new product is carried. You really don’t want to do that.

    You’d be much better off with something along the lines of a products table where each row is a product, an orders table, and an orders_products table that has an fk of the order and product to tie each product from a specific order to that order. Then just tally everything up when needed. The time required for a computer to do that math is nothing compared to the time you’ll waste with maintenance with the idea above, especially once you start adding new columns to that table and it has millions of rows in it, which takes some time.

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

Sidebar

Related Questions

I'm building out an admin area for an ecommerce site where the user can
If I am building a multi-shop e-commerce solution and want the orders table to
Im building a CMS (ASP.NET C#) and I am currently looking at how to
I am currently building an ecommerce site with PHP/MySQL. Recently, I have been working
Building a website using a PHP based Ecommerce product Magento. The problem I have
I am currently building a new style ecommerce shopping cart to test various scenarios
I'm working on building a website using Magento eCommerce. I set up a subversion
I'm building an ecommerce site using S#arp Architecture. I'm trying to map a hierachy
I'm attempting to use the DotNetCart ecommerce module in a solution we are building.
I'm building e-commerce application. Path to the order looks like /Orders/Details/{orderId} . However I

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.