At 10:59 -0700 9/10/09, Dusko Sobic wrote:
>In brief - I have a table with 250 rows of data and I am trying to
>fill in 2 columns with ajax calls.
>--------------------------------------------------
>var sel_list_queue = new Array(# this is an array with more than 200
>IDs#);
>
>if(sel_list_queue.length>0) {
>
>     var url = 'ajax/getData.php';
>     var fromd = '2009-10-10';
>     var tod = '2009-10-11';
>
>     for (var i = 0;i<sel_list_queue.length;i++)
>     {
>
>         if(sel_list_queue[i]!=''){
>
>             var spanname = "loader_req_" + sel_list_queue[i];
>             var divname = "req_" + sel_list_queue[i];
>             aja(url, spanname, divname, sel_list_queue[i], 0, fromd,
>tod);
>
>
>             var spanname = "loader_tot_" + sel_list_queue[i];
>             var divname = "tot_" + sel_list_queue[i];
>             aja(url, spanname, divname, sel_list_queue[i], 1, fromd,
>tod);
>         }
>
>
>     }
>
>}
>
>function aja(url, spanname, divname, l_id, to, fromd, tod){
>
>     new Ajax.Request('myajax/create_curl_package.php', {
>           method: 'post',
>           parameters: {
>             listid:l_id,
>             total:to,
>             fromd:fromd,
>             tod:tod
>           },
>           onLoading: function(){Element.show(spanname);},
>           onSuccess: function(t) {
>               Element.hide(spanname);
>               $(divname).update(t.responseText);
>           }
>         });
>
>}
>--------------------------------
>
>getData.php do SELECT COUNT(`id`)...
>
>Problem: When I start this script I see "Loading..." in every field in
>mentioned 2 columns, and results start showing. At one moment, when
>getData.php do COUNT() on tabel with 18 000 000 rows everything stops.
>Mysql have no processes in list, about 100 "Loading..." messages are
>still on the page.
>
>What could be bottleneck in your opinion. Please help.
>
>php script do not return any error, i have not found anything in
>Apache log
>
>Thank you in advanced!

I'm far from the greatest expert on this list, but it strikes me that 
to do a separate ajax call for every one of these cells (that /is/ 
what you're doing isn't it? - I'm not imagining it?) is terribly 
inefficient, not least with regard to load on the server.

I'm not going to suggest in any detail how to do it, because I'm sure 
others will have better ideas than me, but it must be possible to 
structure this in such a way that you do one ajax call to cover the 
whole lot. Then it's a matter of returning the data in an appropriate 
way so that you can populate the cells with client-side JS 
programming.

Just my 2p worth (I am in the UK, after all).

-- 
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

640K ought to be enough for anybody.
    -- Bill Gates, 1981

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to