Re: Re: how dod you get to do multiple mysql queries concurrently?
| From: | Richard Lynch | Date: | Fri, 25 Jan 2008 18:32:08 +0000 |
| Subject: | Re: Re: how dod you get to do multiple mysql queries concurrently? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268121@lists.php.net to get a copy of this message | ||
On Fri, January 25, 2008 11:21 am, Jochem Maas wrote:
> Per Jessen schreef:
>> Colin Guthrie wrote:
>>
>>> Per Jessen wrote:
>>>> Colin Guthrie wrote:
>>>>
>>>>> Per Jessen wrote:
>>>>>> I know how to do multiple queries - the key issue in my question
>>>>>> was how to do them concurrently (i.e. in parallel).
>>>>> So you want to make PHP multithreaded???
>>>> No, just the mysql queries.
>>> So really what you want is mysqli_multi_query_async()? I've not
>>> really
>>> seen this unf. (not to say it doesn't exist tho').
>>>
>>> I think that's probably something for the mysql list rather than
>>> PHP
>>> as PHP just exposes the mysql client API.
>>
>> Well, mysql has no problem running multiple queries in parallel, so
>> if
>> only I could make php issue multiple queries. I guess I'll have to
>> revert to my iframe-rpc setup that I mentioned just two seconds ago.
>>
>> But your suggestion with an async call is just the kind of thing
>> that
>> might be useful. And I think that is a php issue, but then we might
>> be
>> back to threading :-(
>
> have you thought of batch processing via cron? you can have a parent
> process
> run off children to handle each long running query and package the
> results in
> format that's quick to output - thereby minimizing the time taken to
> batch process
> and then have the summary page merely use the latest packaged results.
And if it's just a summary page, it's often better to run the quries
in advance and cache the output in a static page.
Update it as seldom as possible while keeping the users "happy" with
the freshness of the output.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?