[PHP] Re: Survey: MySQL vs PostgreSQL for PHP

2002-07-08 Thread Philip Hallstrom

> > How many here feel PostgreSQL has surpassed MySQL as the better backend for
> > PHP?  This would be based on performance (speed, scalability, etc.) and
> > features.
>
> I've been using MySQL/PHP for quite some time.  Several months ago, I
> wanted to port a project over to PostgreSQL.  I found everything about pg
> (eg the website, documentation, installation process) far less straight
> ahead than MySQL.  So much so, that I didn't get around to actually
> installing pg.

This is actually something they are working on right now.  One thing to
remember is that for quite a while now mysql has had a corporate entity
behind it that can spend money on marketing efforts -- postgresql doesn't
have this since Great Bridge went away...

> Plus, as others have pointed out, the supporting functions in PHP aren't
> as powerful/diverse.  For example, there's no insert id function.

There are sequences however... which once you use them for awhile you'll
hate the way MySQL does it.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Survey: MySQL vs PostgreSQL for PHP

2002-07-08 Thread Philip Hallstrom

> PostgreSQL also has a number of things that it lacks when compared to MySQL.
> For example, it does not support unsigned integers, which forces you to use
> int8 to store timestamps, which will eventually reach 4.2 billion. In case

Is there a reason you can't use the timestamp data type?  It's still 8
bytes, but you don't have to deal with the casting issues...

> PostgreSQL also does not support ENUM type, although you can port your ENUMs
> to PostgreSQL by using CONSTANTS.

It's also worth noting that ENUM isn't part of the SQL standard (at
least according to mysql's own docs)

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

This is true.. but if you add in a good amount of updates (intranet type
of app) then mysql will be much slower because it is locking the entire
table.  But for a lot of small websites it is 90% selects so mysql will be
faster.


> PostgreSQL also does not optimize count(),max() and min() queries, which in
> MySQL are instant regardless of the table size since they are cached
> internally. PostgreSQL on the other hand needs to go every single row in the
> table. However, I should note that PostgreSQL developers I spoke to, told me

I'm pretty sure that count(*) is optimized and if you've got an index on
the columns you want to max/min then it will just look at the index and
not the table...

> PostgreSQL, whenever that happens. PostgreSQL also syncs any inserted or
> updated to disk right away to ensure that you don't loose any data should the

No, it doesn't.  It can, but it doesn't have to.  With the WAL (write
ahead logging) stuff they've added in the 7.x series I am pretty sure
fsync is disabled by default.

> computer crash on the other hand MySQL keeps memory buffers and will often
> not sync to disk right away to avoid disk IO. PostgreSQL offers greater data
> security, which would be important in a shopping cart, however it looses much
> speed in this approach compared to MySQL's approach which is ideal for
> programs where fast inserts are critical, like a web counter for example.

Doesn't this contradict what you're saying below about table-level
locking?  If a thousand people all hit your page at the same time, mysql
can only insert that row one at a time, right?

> still read from a table. In MySQL once a table is locked to write, no other
> user can read from the very same table until the lock is released. This in
> particular makes PostgreSQL much more scalable then MySQL. Unlike MySQL,

> Bottom line is that both MySQL and PostgreSQL have their 'markets'. IMHO in
> most cases MySQL is a simpler, faster and easier solution to use. However, if
> you require 100% data integrity and are dealing with sensitive data and in
> those case probably can spend a little more or hardware PostgreSQL should be
> your tool of choice.

Agreed... there's also the argument that a lot more ISP's have mysql
support than postgresql support so that's a factor as well.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Survey: MySQL vs PostgreSQL for PHP

2002-07-08 Thread Philip Hallstrom



On Fri, 5 Jul 2002, [iso-8859-1] João Paulo Vasconcellos wrote:

> I don't feel that. I run a web site with a big deal of traffic, and in speed
> and scalability, MySQL is better than PGSQL or Sybase. I know because I tryed
> each one of these before getting to MySQL in definitive. Sybase is WAY
> too slow, and Postgres has a habit of melting down from time to time. In the
> features field, if you need referential integrity you can use InnoDB or BDB
> tables in MySQL, wich supports ON DELETE CASCADE and many things more, like
> row-level locking, blah, blah, blah. To keep your data secure, Sybase is a
> better option than PGSQL, because when PGSQL melts down, you lose some
> records as a gift. I had not seen this behavior mainly because I did not ran

What version of postgres were you experiencing meltdowns?  I've only used
pg since 7.x and I recall that the 6.x had some serious problems, but 7.x
has been extremely stable for us...


> PGSQL long enough to see this, and the memory requirements of Sybase are just
> too much to stand. I prefer MySQL above every other, even lacking SP's. Of
> course, my business do not require anything more than standard MyISAM offers,
> so PGSQL may be a better option in some cases.
>
>
>
> On Friday 05 July 2002 17:59, Lazor, Ed wrote:
> > How many here feel PostgreSQL has surpassed MySQL as the better backend for
> > PHP?  This would be based on performance (speed, scalability, etc.) and
> > features.
> >
> > -Ed
>
>
>
> --
> João Paulo Vasconcellos
> Gerente de Tecnologia - NetCard
> Tel. 21 3852-9008 Ramal 31
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Survey: MySQL vs PostgreSQL for PHP

2002-07-05 Thread Glenn Sieb

Has anyone read: PHP and PostgreSQL Advanced Web Programming by Ewald 
Geschwinde and Hans-Juergen Schoenig yet? I'd been waiting for this book to 
come out... but would like to know if it's actually worth the $ first.

Back to the question at hand...

Personally I like PostgreSQL for a few reasons:

Scalability
Ease of use
SECURITY (yeah--well what can I say.. I work for a security company 
LOL--but seriously, Postgres has more security that MySQL does... and more 
flexible...)
Variety of data types (for instance a CIDR block and IP data type...)
Stored procedures
Cleanup built in (vacuum)
Unions
Full Joins
Constraints

But that's just me. :)

Glenn

---
Glenn E. Sieb
System Administrator
Lumeta Corporation
+1 732 357-3514 (V)
+1 732 564-0731 (Fax)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php