Page 1 of 1

Why not to use unbufferd query all the time?

Posted: Fri Jul 02, 2010 2:53 am
by yochai20
i read a lot of info on the subject, the only thing that need to consider is that the "Selected Table" will be locked once you send unbufferd query, i didn't check what'll happen if i run unlock table to the locked table.

Unbufferd are a lot faster then regular query, there is something that i don't see? why not to use it allways?

ohh and this is my first message here.

My Name is yochai:)

Re: Why not to use unbufferd query all the time?

Posted: Sun Sep 05, 2010 5:18 am
by yochai20
no one answer!?

Re: Why not to use unbufferd query all the time?

Posted: Sun Sep 05, 2010 8:20 am
by requinix
Guess not.

Unbuffered queries also prevent you from doing anything else with the connection until you've read all the results, so that means you can't unlock the table. Besides, even if you could you'd corrupt your resultset should anyone make changes while you were reading. (Thus the locking.)

Unbuffered queries may be good for memory usage but they're not good for speed: the PHP you write to read all the results will never be as fast as the internal C code that handles buffered queries. And since 99 times out of 100 you'll be retrieving all the results anyways, just stick to buffered queries.