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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:52:47+00:00 2026-05-26T14:52:47+00:00

My analytics team uses a query like this: SELECT SUM(ul.upload_bandwidth) + SUM(dl.download_bandwidth) AS total

  • 0

My analytics team uses a query like this:

SELECT 
    SUM(ul.upload_bandwidth) + SUM(dl.download_bandwidth) AS total 
FROM 
    upload_facts ul, download_facts dl
WHERE 
    ul.date BETWEEN '2011-09-01' AND '2011-09-30' AND 
    dl.date BETWEEN '2011-09-01' AND '2011-09-30';

This is taking a very long time, over 12000 seconds, due to the “join” that is occurring.

Doing the sum from either table separately takes just a few seconds. I am considering putting a sum per day into a separate table to speed this up. However, I believe that it should be easier than that.

I want to eliminate the join and use subqueries to do this, however I’m not 100% sure how. I tried the following, but it did not work.

SELECT 
    (select upload_bandwidth from upload_facts where date 
      BETWEEN '2011-09-01' AND '2011-09-30') 
    + 
    (select download_bandwidth from downloaded_facts where date 
      BETWEEN '2011-09-01' AND '2011-09-30');
  • 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-26T14:52:47+00:00Added an answer on May 26, 2026 at 2:52 pm
    SELECT
        (SELECT SUM(`upload_bandwidth`) FROM `upload_facts` WHERE `date` 
          BETWEEN '2011-09-01' AND '2011-09-30')
        +
        (SELECT SUM(`download_bandwidth`) FROM `download_facts` WHERE `date` 
          BETWEEN '2011-09-01' AND '2011-09-30')
    AS `total`
    

    That should do it.

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

Sidebar

Related Questions

In Visual Studio 2008 Team System, I just ran Code Analysis (from the Analyze
Google Analytics reads like a seismic chart lately
The Google Analytics setup instructions state: This tracking code snippet should be included in
In VS2008 Team System how do I select some Code Analysis rules? The window
is there a way to detect simple memory leaks like this one with a
Google Analytics use some query parameters to identify campaigns and to do cookie control.
I'm evaluating Microsoft Team Foundation Server for my customer, who currently uses Visual SourceSafe
Our team currently uses Solr as the backend for our search solution and we
I'm developing google-analytics-like analytics map, but i need to choose the correct colors to
So Google Analytics does not have an API that we can use to get

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.