Re: Name for new function
| From: | Kristian Köhntopp | Date: | Mon, 17 Jul 2000 12:52:19 +0000 |
| Subject: | Re: Name for new function | ||
| References: | 1 2 3 4 5 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24736@lists.php.net to get a copy of this message | ||
Derick Rethans wrote:
> The MySQL TODO list says: Subqueries. select id from t where grp in (select grp from g
> where u > 100)
If you do this at the client side, any number of queries
will travel from the client side to the server, waiting
for the answers. This will quickly accumulate round trip
times, read: it will be very slow. It will be particularly
slow if database server and client are not on the same
machine.
For this kind of query to be efficient, it must run at the
server side.
Also, for this to work correctly, you must lock the database
first, then create the grp list, then query the t table for
each grp found, then unlock the database. This scales almost
pessimal.
That's what I meant with "architecturally wrong". It is a gross
and ugly kludge. Do not cement this in any way. Put it as far
away as possible and make sure that everybody using this is DOING
THE WRONG THING and that this extension will go away immediately
the day MySQL learns about subqueries.
You would do really good if you learned to write MySQL extensions
and implemented this on the server side. This is really where this
stuff belongs.
Kristian
--
Kristian Köhntopp, NetUSE AG Siemenswall, D-24107 Kiel
Tel: +49 431 386 436 00, Fax: +49 431 386 435 99
Using PHP3? See our web development library at http://phplib.netuse.de/