]> granicus.if.org Git - php/commit
MFH:
authorAndrey Hristov <andrey@php.net>
Tue, 16 Jun 2009 13:07:14 +0000 (13:07 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 16 Jun 2009 13:07:14 +0000 (13:07 +0000)
commit10ee06ca48370da3f4858b563d0e0765b4059ee9
treeef33b05c58e4d3c7fe211c6d694eb73870228908
parent34842709d65b35a9c7b9cee9ba68e116917a15b8
MFH:
Memory usage optimisation. mysqlnd is not libmysql. mysqlnd does use the
Zend allocator, which means that is easier to hit memory_limit if you
have big stored (buffered) result sets. Before with libmysql you won't
hit memory_limit because libmysql uses libc's allocator and nothing is
checked. Now, with mysqlnd the situation is stricter and it is easier to
hit memory_limit. We try to optimize for big result sets. If a result set
is larger than 10 rows we will start freeing some data to keep memory usage
after 10 rows constant. This will help in the cases where a buffered result
set is scrolled forward only and just only once, or mysqlnd will need to
decode data from the network buffers again - yes, it is a trade-off between
CPU time and memory size. The best for big result sets is of course using
unbuffered queries - for comparison : 3 Million rows with buffered take
at least 180MB, with buffered you will stay at 3MB, and unbuffered will be
just 7-8% slower.
ext/mysqlnd/mysqlnd_debug.c
ext/mysqlnd/mysqlnd_result.c