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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:13:09+00:00 2026-05-25T18:13:09+00:00

The question I need to answer is this What is the maximum number of

  • 0

The question I need to answer is this “What is the maximum number of page requests we have ever received in a 60 minute period?”

I have a table that looks similar to this:

date_page_requested      date;
page                     varchar(80);

I’m looking for the MAX count of rows in any 60 minute timeslice.

I thought analytic functions might get me there but so far I’m drawing a blank.

I would love a pointer in the right direction.

  • 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-25T18:13:09+00:00Added an answer on May 25, 2026 at 6:13 pm

    You have some options in the answer that will work, here is one that uses Oracle’s “Windowing Functions with Logical Offset” feature instead of joins or correlated subqueries.

    First the test table:

    Wrote file afiedt.buf
    
      1  create table t pctfree 0 nologging as
      2  select date '2011-09-15' + level / (24 * 4) as date_page_requested
      3  from dual
      4* connect by level <= (24 * 4)
    SQL> /
    
    Table created.
    
    SQL> insert into t values (to_date('2011-09-15 11:11:11', 'YYYY-MM-DD HH24:Mi:SS'));
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    

    T now contains a row every quarter hour for a day with one additional row at 11:11:11 AM. The query preceeds in three steps. Step 1 is to, for every row, get the number of rows that come within the next hour after the time of the row:

      1  with x as (select date_page_requested
      2          , count(*) over (order by date_page_requested
      3              range between current row
      4                  and interval '1' hour following) as hour_count
      5      from t)
    

    Then assign the ordering by hour_count:

      6  , y as (select date_page_requested
      7          , hour_count
      8          , row_number() over (order by hour_count desc, date_page_requested asc) as rn
      9      from x)
    

    And finally select the earliest row that has the greatest number of following rows.

     10  select to_char(date_page_requested, 'YYYY-MM-DD HH24:Mi:SS')
     11      , hour_count
     12  from y
     13* where rn = 1
    

    If multiple 60 minute windows tie in hour count, the above will only give you the first window.

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

Sidebar

Related Questions

I basically need the answer to this SO question that provides a power-law distribution
I have seen the answer to this question. However, I have a page where
I really need an answer to this question. I am working on a project
I am having an ASP.net page with userid and question and answer I need
The answer to this question may be obvious but I need to ask it
Hey, Like in title can someone answer this simple question? I need draw line
I had an interview and I could not answer this question. You have an
That might be silly question but I really need to know the answer. If
I couldn't find a straight answer to my question and need to know it
Weird question, but i need to find an answer. Is there any way, in

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.