Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old March 28th, 2003, 09:09 PM
blockcipher blockcipher is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2003
Posts: 701 blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 7 h 40 m 21 sec
Reputation Power: 55
Why should I learn PostgreSQL?

This may be a dumb question, but I'm wondering if there are any compelling reasons for me to learn PostgreSQL, especially if I'm very happy with MySQL. Let me give you a little background. Most of what I've done with databases has been web-based applications where we have more people reading from the database instead of writing to the database. So far multiple insert concurrency has not been a problem. (i.e. transactions have not been necessary) However, I'm looking to expand my knowledge a bit considering I'm looking into getting smart with data warehousing and perhaps modifying existing applications for better data protection. Commercially, I've primarily used MS-SQL or Oracle, however some of us have been looking into alternate technologies.

Either way, simply put, I'd like to have some really good reasons to look into something other than MySQL. No offense, but please do two things when answering:

1. Make sure you're current on what each database can do. Either do to when a post was posted or user knowledge, it seemed that some of the posts I've looked at didn't have the most up-to-date information. Please keep in mind future MySQL features as I've been keeping an eye on them, especially sub-queries.
2. If you have a reason, please include why it's a good reason. This was something else that seemed to be missing from some of the posts I've seen. For example, and this is a simple one, transactions are a good feature because they can ensure proper data integrity when issuing multiple insert/update/delete commands or when you want to update a table/insert into a table based on the results of a sub-select statement.

One additional question I'd like answered is whether or not foreign key constraints are truly useful when the application you're writing isolates the user from the actual SQL code? I fully understand the need for such constraints if the user is performing queries directly, but, at least in my experience, we've made it a habit of leaving them off mainly because the haven't been necessary. The code we've written has been structured to ensure things are deleted correctly and has been tested to ensure it works properly. Basically, I'm looking for alternate opinions.

Thanks in advance.
__________________
blockcipher
---------------
Gratuitously stolen...
mysql> SELECT * FROM user WHERE clue > 0;
0 Results Returned.

PHP5/MySQL/UTF-8
My Tech Blog

Reply With Quote
  #2  
Old March 28th, 2003, 11:24 PM
hedge hedge is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2002
Posts: 692 hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 20 h 2 sec
Reputation Power: 19
I have been using Oracle for years so that's where most of my experience lies. When I went looking for an open-source alternative PostgreSQL seemed to have just about all the functionality as Oracle. (Oracle is too expensive)

The biggie for me was a stored proc language very similar to pl/sql. I write all my page validation routines in stored procs so this is very necessary to me. AFAIK mySQL does not support this.

I also cannot live without transactions, actually I don't know how people get away without.

Reply With Quote
  #3  
Old March 29th, 2003, 12:01 AM
a.koepke's Avatar
a.koepke a.koepke is offline
Second highest poster :p
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Jul 2001
Posts: 7,323 a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 8 m 45 sec
Reputation Power: 26
I have been using PostgreSQL for about 2 years now and love it. The reason I never liked MySQL is due to the fact that their was no data intergrity. I have been doing database work for a while now and think that any database that doesnt have proper data integrity isnt worth using. Yes you can do what you can to ensure that everything is done right in your code but despite this I have seen databases with rouge data in them even when this was all done. I prefer to have proper data integrity in a database.

Reply With Quote
  #4  
Old March 29th, 2003, 11:09 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,298 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 1 h 54 m 21 sec
Reputation Power: 41
Yes, PostgreSQL has much better data integrity than MySQL, but that is only the beginning of the difference between them. To me the most interesting difference is in area of logic:
1. The expressive relational power that PostgreSQL gives you in managing and querying your data.
2. Its power to encapsulate logic in the database (views, constraints, triggers, stored procedures, rules).
3. It's extensability and flexibility, such as the ability to create your own datatypes and operators.

In fact, I would argue that in logical capabilities, PostgreSQL has advantages beyond some of the best commercial systems, with the possible exception of Oracle.

So, while it doesn't have some of the robust enterprise features of the big boys in the field (at least, not yet ), it definitely has the logical capabilities.

Really, the answer to your question depends on just how much you understand about relational database technology itself, and why it is important. I will just give you a few links to help you further explore what I mean:

http://brainscraps.com/faq/pg_my.html (my personal rant on PG vs MY)

Some of my posts in various forums:

http://www.webmaster-forum.net/view...=133&highlight=
http://www.sitepointforums.com/show...?threadid=90658
http://www.sitepointforums.com/show...threadid=100966
http://www.sitepointforums.com/show...?threadid=89045

Some of my old Devshed posts: (warning: I have learned a few more things about relational theory since then)
http://forums.devshed.com/showthrea...&threadid=35171
http://forums.devshed.com/showthrea...&threadid=31435
http://forums.devshed.com/showthrea...40&pagenumber=2 (2nd page of a long, interesting thread)

And, if you really have a burning desire to learn what this "relational" stuff is all about, these sites will point you in the right direction:
Relations and Relationships
www.dbdebunk.com
www.thethirdmanifesto.com
comp.databases.theory
__________________
The real n-tier system:

FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

Amazon wishlist -- rycamor (at) gmail.com

Reply With Quote
  #5  
Old March 31st, 2003, 09:13 AM
bcyde's Avatar
bcyde bcyde is offline
Me likey breadsticks...
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2003
Location: Los Angeles
Posts: 1,189 bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 12 m 57 sec
Reputation Power: 12
Send a message via AIM to bcyde Send a message via Yahoo to bcyde
Interesting read...

Read your personal rant about MySQL vs Postgres, great work, btw are you going to continually update that doc for each version new release version of Postgres and MySQL, or are you pretty much happy with it and going to let it stand as a complete document with correct info as of its writing?

BTW for anyone who is following the ongoing "industry RDBMS" vs. true relational databases discussions, has anyone tried Alphora or Required Technologies that Fabian Pascal mentions in this article ?

-b
__________________
PostgreSQL, it's what's for dinner...

Last edited by bcyde : March 31st, 2003 at 10:48 AM.

Reply With Quote
  #6  
Old March 31st, 2003, 12:34 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,298 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 1 h 54 m 21 sec
Reputation Power: 41
I'll actually be trying to expand that into a list of FAQs on PostgreSQL, perhaps some examples of RULEs, functions, etc...

And, I hope to keep it up-to-date. My interest is in helping people to understand some of the more advanced logical concepts available in PostgreSQL that you don't seem to find much documentation about. I have a feeling many PG users are designing the same databases they would have designed with MySQL, which is a grave mistake.

Yes, I have tried to play with Alphora, but gave up in disgust over all the .NET stuff I had to install and troubleshoot. I suppose it'll be great for those .NET lovers, but I want something simple and open in nature. I noticed that there are a couple of interesting open-source projects listed at http://www.hughdarwen.freeola.com/T...b/Projects.html (Hugh Darwen and C.J. Date are some of the prime thinkers behind the concepts we are talking about here.)

I will be very interested in seeing what comes of these open libraries. For example, I see no reason why someone couldn't take PostgreSQL's great back-end, and develop a "D" relational implementation for it. (wish I had the time, and the C expertise for that...)

Reply With Quote
  #7  
Old March 31st, 2003, 07:32 PM
blockcipher blockcipher is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2003
Posts: 701 blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level)blockcipher User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 7 h 40 m 21 sec
Reputation Power: 55
Thank you for your responses. The information has proven to be a bit more insightful that what I've read so far. Let me address a few of the things discussed.

1. hedge: good point on the stored procedures. MySQL is planning on having this feature, however I think I'll be needing a bit of knowledge in using it sooner than later.

2. This may be a dumb question, but how does MySQL NOT have data integrity? If there was no such thing, than how do sites like Yahoo and slashdot manage to keep on trucking? Aren't features such as foreign key constraints and transactions used to help preserve data integrity? This seems to be a very inaccurate statement from everything I've seen. Better data integrity may or may not be a true statement, I'm not experienced enough to argue that point, but a complete lack of data integrity I find very unlikely.

3. Rycanor: thanks for the good info. You're posts have been interesting reads. I have just a couple questions: what do you mean by rules and what other types of constraints are there? I know of FK constrainds, PK/Unique key constraints, and non-null constraints, IIRC.

Thanks in advance.

Reply With Quote
  #8  
Old April 1st, 2003, 12:07 AM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,298 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 1 h 54 m 21 sec
Reputation Power: 41
Quote:
2. This may be a dumb question, but how does MySQL NOT have data integrity? If there was no such thing, than how do sites like Yahoo and slashdot manage to keep on trucking? Aren't features such as foreign key constraints and transactions used to help preserve data integrity? This seems to be a very inaccurate statement from everything I've seen. Better data integrity may or may not be a true statement, I'm not experienced enough to argue that point, but a complete lack of data integrity I find very unlikely.


No, anyone who says MySQL has no data integrity doesn't know what data integrity is. Every database system has some level of data integrity, but some allow you to have much more control over exactly what you can make the system do.

Quote:
3. Rycanor: thanks for the good info. You're posts have been interesting reads. I have just a couple questions: what do you mean by rules and what other types of constraints are there? I know of FK constrainds, PK/Unique key constraints, and non-null constraints, IIRC.


The term 'constraint', as applied to database systems, is kind of a general term. It means the whole range of things you can do to direct your database to allow, or not allow certain things. MySQL has very few options for this, such as primary key, foreign key, NOT NULL, etc...

An example of the type of constraint MySQL is missing would be the CHECK constraint, which allows you to add additional constraints to any column in a table definition, such as

CREATE TABLE product(
id int NOT NULL,
name text NOT NULL,
price numeric(11,2) NOT NULL CHECK(VALUE >= 5)
);

This would not allow a product price to be less than $5. This is a small, simple example; the constraint can be at any level of complexity, giving you an amazing amount of power over your data)

Theoretically, constraints can be placed on columns, tables, and even the whole database. The idea here is that you should be able to arbitrarily decide what rules your database should play by to keep your data in a certain type of internal consistency, such as firing a trigger to update the REQUEST_PARTS table if any PRODUCT quantity falls below 100 (an example of a database-level constraint)

RULEs are a special case of constraints available to PostgreSQL users, which essentially does for any query on a table what mod_rewrite does for URL requests in Apache. It allows you to re-direct the action of a query to do something else internally. For example, if you wanted to record a log everytime someone views the data in a certain table, you could just create a RULE on that table, specifying DO ALSO INSERT INTO logtable values(NOW(), CURRENT_USER). So, everytime a user in the database views that data, you have a log of when that happened.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Why should I learn PostgreSQL?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway