Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Who else does PgSQL / PHP?

Who else does PgSQL / PHP?
Thread Tools
Junior Member
Join Date: Nov 1999
Status: Offline
Reply With Quote
Oct 20, 2002, 11:17 PM
 
So, I love PostgreSQL. Way more than MySQL. I can write an object-relational database system with PgSQL and PHP. Does anybody else do this, or am I all alone? I know MySQL is easier; perhaps that's why it's more popular.
     
Fresh-Faced Recruit
Join Date: Sep 2002
Status: Offline
Reply With Quote
Oct 22, 2002, 01:56 PM
 
I use PostgreSQL with PHP and Java and I agree that it is clearly a better database.

MySQL hosting is more widely available and most beginner tutorials use it. It also supports Windows better. People won't change until they have a problem and for most people MySQL works fine.
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Oct 22, 2002, 05:01 PM
 
What's the difference between the two - conceptually, I mean, not the obvious functional difference. I've seen some comments from people saying it's excellent for more 'serious' applications but I'd like to know why. Better performance? Easier syntax?
Computer thez nohhh...
     
Junior Member
Join Date: Nov 1999
Status: Offline
Reply With Quote
Oct 22, 2002, 06:34 PM
 
Well, Simon, I think the difference _is_ functional, not conceptual. But these are some of the functional things that make it powerful, and perhaps they will expand your concept of what it can do. Most important, to me at least, is the ability for the language to be extended by other languages. Currently, I use PgSQL extended by Psql/PL, which is an extension that comes with the language. It allows me to define functions that are stored in the database model, and these functions can perform access to the database quite quickly. A case study would be the first time I realized I _had_ to use a function. I have crumbs (you know, those little strings of text that tell you where you are in the site, like "About > People > Partners > John Doe > Resume") at the top of my site. All of my pages are, of course, stored in the database. So, how could I get this returned to me when I call up the page 'Resume', knowing _only_ the page_id of its parent (in other words, I'm absolutely not going to store this whole string of page ids into the row in my table about 'Resume'). A recursive function, of course, that looks up the parent id until there are no more parent ids. Could be done in PHP, with 5 database queries. Or done in one query, "SELECT myFunction(myPageID);" with this extension. Another functional difference is the way PostgreSQL handles tables and databases. In MySQL, you can inquire the database about a table name, column names in that table, etc. In PG, you actually have this data stored in a different part of the database. I'm not really sure how to explain this; it makes more sense once you get into the syntax. Another difference would be its ability to optimize the database for queries, depending on the type and amount of data you have in the database. How can it do this? Well, PG comes with a much more powerful integrity checking ability. Most importantly, the ability to make use of FOREIGN KEYS. (You can name something a FK in MySQL, but it actually doesn't do jack.) There are lots of places on the web that explain what these are if you don't know, and explain it much better than I could.

So, anyway, more speed, better optimization, more powerful advanced functions that MySQL would be absolutely incapable of performing, and referential integrity are my big reasons to use PgSQL. But the language, though SQL, is more complex, expecially when you're trying to do stuff that is "simple" in MySQL, like get the names of all columns in a table, or count table rows.

--Richard
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Oct 23, 2002, 04:46 AM
 
Thanks for the answer. You've got me curious now. I may start investigating this over the Christmas break.

Cheers Richard
Computer thez nohhh...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:14 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2