[TYPO3-dev] Tip: use SQL function COUNT(*)

Ernesto Baschny [cron IT] ernst at cron-it.de
Fri Jul 18 21:56:49 CEST 2008


ries van Twisk wrote: on 18.07.2008 21:39:

>> A result set is not "data" but just a pointer to some structure on the
>> server which can be be used to retrieved data with the "fetch" commands.
>> The data is not pre-fetched by mysql or the client.

> If you look at the PHP's code that directly calls libmysql.
> 
> Then libmysql get's the number of records from it's internal dataset here:
 > (...)
> then read_query_result is called to fetch all data into memory from the 
> mysql server
> see here : 
> http://leithal.cool-tools.co.uk/sourcedoc/mysql509/html/mysql_8h.html#a115
> 
> So that means it's not a cursor or anything but the whole dataset is 
> wetched into lib_mysql and mysql_num_rows
> simply reads a value from it's internal array and doesn't call the 
> server, nor mysql_fetch_row calls the server
> to get data from the server. It's all memmory based in libmysql.

Oh my gosh, you are right. Thanks for pointing that out!

Cheers,
Ernesto




More information about the TYPO3-dev mailing list