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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:01:31+00:00 2026-06-08T00:01:31+00:00

Hopefully the title isn’t too confusing. Here is my code SELECT SRV_NAME, TOT_CPU, TOT_MEM,

  • 0

Hopefully the title isn’t too confusing. Here is my code

SELECT SRV_NAME, TOT_CPU, TOT_MEM, SNAP_DATE
FROM capacity2.SRV_CAPACITY_UNIX
WHERE TOT_CPU >= 90 OR TOT_MEM >= 90 AND SNAP_DATE BETWEEN to_date('14-jun-2012 00:00:00', 'dd-mon-yyyy hh24:mi:ss') AND to_date('14-jul-2012 00:00:00', 'dd-mon-yyyy hh24:mi:ss')
ORDER BY SRV_NAME desc, SNAP_DATE desc;

A sample of the data the code returns is as follows:

SNAP_DATE       TOT_CPU TOT_MEM SRV_NAME
6/22/2012 0:00  99.98   70.86   server555
6/22/2012 0:05  99.98   70.9    server555
6/22/2012 0:10  99.98   70.93   server555
6/22/2012 0:15  99.98   71.06   server555
6/22/2012 0:20  99.98   70.87   server555
...
6/22/2012 23:35 99.97   71.12   server555
6/22/2012 23:40 99.99   71.12   server555
6/22/2012 23:45 99.97   71.12   server555
6/22/2012 23:50 99.98   71.12   server555
6/22/2012 23:55 99.98   71.12   server555

The objective:

Extract data for servers (the servers are within the capacity2.SRV_CAPACITY_UNIX database) that are 90% and above (in TOT_CPU and TOT_MEM) over a given duration (in this case a month/30 days). I need to graph this data and by default the data is recorded every 5 minutes so I’m left with 288 rows in one day over the span of approximately 30 days. This is approximately 8,600 rows that I am left with to plot on a graph which is obviously impractical.

Therefore what I need to do is to write a SQL query that will only extract the average TOT_CPU and TOT_MEM of each day so I will only be left with 30 rows of data I need to plot for 30 days (one row for each day).

This is my first time using Stack Overflow so I have attempted to be as clear as possible. If you need any information I will surely provide it.

  • 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-08T00:01:34+00:00Added an answer on June 8, 2026 at 12:01 am

    Based on the TO_DATE function, I’ll assume this is Oracle. Therefore, it should look somewhat like this:

    select SRV_NAME, TRUNC(SNAP_DATE) SNAP_DATE, 
           avg(TOT_CPU) AVG_TOT_CPU, avg(TOT_MEM) AVG_TOT_MEM
    FROM capacity2.SRV_CAPACITY_UNIX
    WHERE TOT_CPU >= 90 OR TOT_MEM >= 90 
    AND SNAP_DATE BETWEEN to_date('14-jun-2012 00:00:00', 'dd-mon-yyyy hh24:mi:ss') 
                  AND     to_date('14-jul-2012 00:00:00', 'dd-mon-yyyy hh24:mi:ss')
    group by SRV_NAME, TRUNC(SNAP_DATE)
    

    Please notice that this is broken down by server as well, you probably will plot one series per server.

    Also notice that, if by any chance, there’s no logged data for a specific day, that day will not be present in the results and your plotting logic should deal with that.

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

Sidebar

Related Questions

Hopefully my title isn't too confusing. Anyways, I'm still learning CSS and right now
Confusing title, hopefully some code will clarify: struct MyNestedType { void func(); }; struct
Hopefully that title isn't too cryptic. What's happening is I have a jQuery AJAX
I'm not even sure what title to give this question; hopefully the code will
I'm pretty new to C++ terminology so hopefully my title is not too off.
I had some problems figuring out a good title, but hopefully the code examples
Hopefully the title of my question was clear enough. Here's a really simple version
Please excuse the poorly worded title, hopefully I can explain the issue here. I've
Ok so my question title may have been a little confusing. Here's my example:
Hopefully I've explained it well enough in the title but here is what 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.