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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:43:13+00:00 2026-06-14T01:43:13+00:00

I have a webpage which auto-updates a list of users and their comments every

  • 0

I have a webpage which auto-updates a list of users and their comments every 30 seconds.

There could be up to 300-400 users users on the site at a time.

So every 30 secs, a PHP script is called via AJA which runs this:

SELECT `user` .*, by_user.name as updated_by 
                "FROM `user`
                "LEFT JOIN `user` by_user ON ( `user`.last_updated_by = by_user.user_id ) 
                WHERE `user`.active= 1 AND `user`.group_id =.$group_id.
                AND `user`.last_updated > (NOW() - INTERVAL 30 SECOND)

Would it be better to not use that date calculation (NOW and INTERVAL) and instead record the datetime of the last poll and then check against 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-06-14T01:43:14+00:00Added an answer on June 14, 2026 at 1:43 am

    NOW() - INTERVAL 30 SECOND is only done once for the query, and it’s blazing fast. The overhead to do anything else would almost surely incur worse impact on performance.

    If you have compound index (active, group_id, last_updated) it will make the performance optimal.

    Since you do a u.* in the select, I wouldn’t try to create a covering index for the query.

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

Sidebar

Related Questions

I have a webpage which I would like users to be able to send
I have a webpage which has games on. I realize that there will be
I have written a webpage with GWT which contains auto-generated Hyperlinks. These hyperlinks currently
I have an webpage which posts some data and then redirects to a page
Here's the situation I have a webpage which has one drop down called prefer.
I have a WebPage on which I have to detect and prevent usage of
I have created a Webpage which will post as post method..not as get method.
I have content on a webpage which is both sent from the server at
I have an image on a webpage which is being dynamically generated by a
I have a webpage, on which I am using Ajax to replace different divs

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.