Why not to use unbufferd query all the time?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yochai20
Forum Newbie
Posts: 6
Joined: Tue May 18, 2010 4:27 pm

Why not to use unbufferd query all the time?

Post 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:)
yochai20
Forum Newbie
Posts: 6
Joined: Tue May 18, 2010 4:27 pm

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

Post by yochai20 »

no one answer!?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post 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.
Post Reply