You are here: Re: MySQL prepare statement performance bottom-neck « PHP Programming Language « IT news, forums, messages
Re: MySQL prepare statement performance bottom-neck

Posted by Richard Levasseur on 06/30/06 22:17

If it is MySQL < 4.1, then you are using emulated prepared statements,
which may be causing the slowdown. It wouldn't surprise me if PEAR was
doing some funny regex's to parse the queries, escape the values, etc.

If you're using a database abstraction library, maybe try switching the
abstraction library (See PDO and Adodb, among others), it might speed
things up.

It should also be noted that using prepare/execute requires 2 trips to
the server
(http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html),
since it has to send it to be parsed, then send it to be executed.
This would account for the exact factor of 2.


howachen@gmail.com wrote:
> Hi,
>
> When doing mysql query (SELECT statements) in php, we often use prepare
> statement to prevent SQL injection. However, I just noticed that the
> prepare statements can SLOW the number of queries per second by a
> factor of 2 times (max).
>
> So are there any faster method that can prevent SQL injection, but has
> a better performance?
>
> Thanks.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация