Re: how dod you get to do multiple mysql queries concurrently?
| From: | Richard Lynch | Date: | Mon, 28 Jan 2008 18:26:26 +0000 |
| Subject: | Re: how dod you get to do multiple mysql queries concurrently? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268217@lists.php.net to get a copy of this message | ||
On Sat, January 26, 2008 3:17 am, Per Jessen wrote:
> Richard Lynch wrote:
>
>> On Fri, January 25, 2008 3:35 am, Per Jessen wrote:
>>> I have a website where some of the pages require several mysql
>>> queries -
>>> they're independent, so in principle they could easily be run in
>>> parallel. Has anyone looked at doing that?
>>
>> If MySQL has implemented "cursors" in some new version, you have
>> just
>> described a "cursor"...
>>
>> There may be something else in MySQL to do this, mind you, but
>> that's
>> the easiest way I know of in other DBs...
>
> cursors exist in mysql too, but I don't quite see how I could use them
> to run two queries concurrently? Also, these queries don't return a
> lot of data.
When you create a cursor, it's like a handle to a running query in the
background process, and returns immediately.
Create three cursors, and you SHOULD have them running in parallel.
The overhead of a cursor may be more than you save for fast queries
though... Or maybe not, as a cursor should not have THAT much
overhead.
Only used them in PostgreSQL and SQL Server/Sybase, though, so don't
know for sure about MySQl.
--
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?