Re: Survey: MySQL vs PostgreSQL for PHP

From: Date: Sun, 07 Jul 2002 12:29:41 +0000
Subject: Re: Survey: MySQL vs PostgreSQL for PHP
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-105956@lists.php.net to get a copy of this message
From the php.net manual for pg_fetch_array: Note: From 4.1.0, row became optional. Calling pg_fetch_array() will increment internal row counter by 1. "Ilia A." wrote: > > On July 5, 2002 07:54 pm, Pete James wrote: > > "Ilia A." wrote: > > > The biggest annoyance I've come across is > > > the fact that while using PostgreSQL with PHP is that when you fetch a > > > row you must specify the number of the result, while in MySQL, that is > > > handled internally by PHP for you. This means that your PHP scripts must > > > track the row numbers themselves. > > > > This is not so... see pg_fetch_array. Since PHP 4.1.0, you no longer > > need the row number. > > It may work without, but according to the manual on php.net > pg_fetch_array > pg_fetch_object > pg_fetch_row > > REQUIRE a row number. If that is no longer the case as you claim, perphaps > someone needs to inform the developers and have them update the > documentation. > > > > > > Now we come to the actual database speed itself. In this regard in most > > > applications MySQL is MUCH faster probably because it has to do allot > > > less work then PostgreSQL does. For example, lets analyze the most common > > > action performed in a database system, a SELECT. When you do a select in > > > MySQL, MySQL internally locks the table for the duration of the select. > > > PostgreSQL on the other hand does a row level lock, internally, for every > > > row you select. > > > > Is this really what you want? Doesn't this mean that PostgreSQL would > > be more efficient for larger user volumes? Locking an entire table > > isn't usually a good thing. > > > > Not necessarily, locking entire table has its pluses and minuses. The BIG > minues is that while the entire table is locked you cannot do anything until > the lock is released. On the other hand, it is MUCH faster to lock the entire > table then the inidividual rows. PostgreSQL would be more effecient on a > system that does lots of locking, but on a system without or few locks MySQL > will beat it hands down. > > Ilia > FUDforum Core Developer > ilia@prohost.org

« previous php.general (#105956) next »