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

  • Home
  • SEARCH
  • 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 7666747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:54:48+00:00 2026-05-31T14:54:48+00:00

I am using Ajax to send query to PHP server, which then run the

  • 0

I am using Ajax to send query to PHP server, which then run the SQL query to get data. Because the query involves three tables (two large ones), so JOIN the three tables is very slow.

Then I split the SQL query to three queries. It improves the efficiency (for small dataset). But for large dataset, because the PHP program runs the three queries one by one, and processes the result after each, there will be 30 second timeout (by default). I don’t want to remove this default setting.

To avoid timeout, I am also considering running the three query and returning the result to JS, and let client side to do processing.

Is there other way to do that?

add

Basically, I want three output, title, extviews, allviews, for each item, WHERE extviews>somevalue. title is from one small table, extviews and allviews are aggregated from two different large tables. I have all the fields indexed, but joining the two big tables still requires a long time.

So I first aggregate one table to get extviews for each item, and also a list of item id. The results are organized as an array for JSON output to JS. Then using the list of id, I get the title for each item, and aggregate the other table to get allviews. Then I update the array with the new results.

  • 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-31T14:54:49+00:00Added an answer on May 31, 2026 at 2:54 pm

    Unless your mysql server is really overloaded, it’s usually quickier to use joins. I guess you’ve already defined indexes on your tables? (for fields used in join condition & where clauses)
    Doing the processing on the client side might also be a problem, since you’ll have to send a lot of data in order to do the join…

    Edit:
    If all “easy” optimisation is done, then you have 2 choices… The one you just described (doing it on client size, if it’s possible – what is the size (in bytes) of the json arrays you send to the client?)
    Your other choice is to do the processing in the background (via cron) & cache somehow the results.

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

Sidebar

Related Questions

I am using dojo and ajax to send a time stamp to PHP, which
I am using an Ajax call to a PHP file to get data from
I am using Ajax POST method to send data, but i am not able
I'm using Jquery, Ajax and PHP to try and send a variable to be
I have made an AJAX chat using Javascript, PHP, and MySQL. I send the
I am creating a chat using Ajax requests and I'm trying to get messages
I'm using $.post() to call a servlet using Ajax and then using the resulting
I've got form which when submitted (using AJAX) returns a bunch of client details.
I'm using php to return an array of data, with the command json_encode() .
I'm using AJAX to send a web service call to Sharepoint to retrieve list

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.