Slashdot Mirror


PostgreSQL Slammed by PHP Creator

leifbk writes "'The Web is broken and it's all your fault' says Rasmus Lerdorf, the creator of PHP. He talks about not trusting user input, and the brokenness of IE, which is all fine. Then he makes a statement about MySQL vs PostgreSQL: 'If you can fit your problem into what MySQL can handle it's very fast,' Lerdorf said. 'You can gain quite a bit of performance.' For the items that MySQL doesn't handle as well as PostgreSQL, Lerdorf noted that some features can be emulated in PHP itself, and you still end up with a net performance boost. Naturally, the PostgreSQL community is rather unimpressed. One of the more amusing replies: 'I wasn't able to find anything the article worth discussing. If you give up A, C, I, and D, of course you get better performance- just like you can get better performance from a wheel-less Yugo if you slide it down a luge track.'"

104 of 527 comments (clear)

  1. I love my Yugo luge commute by Anonymous Coward · · Score: 4, Funny

    It's very fast and I haven't been killed yet.

    1. Re:I love my Yugo luge commute by Rob+T+Firefly · · Score: 3, Funny

      The luge isn't something you just dump Yugos on, it's a series of tubes!

    2. Re:I love my Yugo luge commute by LurkerXXX · · Score: 3, Insightful

      Your data is pretty worthless if you can't be bothered with ACID complience to make sure it is consistant.

    3. Re:I love my Yugo luge commute by nocomment · · Score: 2, Interesting

      I have. I built a 'Do Not Call' DB server to house 2 do not call lists for a telemarketer. A simple php interface. It searches through something like 10 million records in a fraction of a second. You don't even have your finger lifted off the mouse button and you already know the circumstances surrounding that phone number. Whether it's one they can call if a prior business relationship exists, if the number is free and open to annoy during dinner, or whether they cannot call under any circumstances whatsoever. The sucker flies. It's running on 900Mhz AMD Duron, 256M RAM, Generic IDE HD, running OpenBSD, and Postgresql.

      --
      /* oops I accidentally made a comment, sorry */
      /* http://allyourbasearebelongto.us */
    4. Re:I love my Yugo luge commute by beckerist · · Score: 2, Funny

      Give up Acid and your whole world becomes quite clear! Just ask the '70's!

    5. Re:I love my Yugo luge commute by ajs · · Score: 4, Informative
      Your data is pretty worthless if you can't be bothered with ACID complience to make sure it is consistant.

      For the last 10 years, MySQL data has been atomic across single transactions.

      For the last 5 years, MySQL data has been atomic across transactions.

      For the last 2-3 years, MySQL has supported the full gammut of ACID features.

      Can we PLEASE stop beating this particular dead horse?

      The MySQL 5.0 FAQ

      MySQL still lacks many of the high-level features of databases like Oracle, and for that many of us, the USERS of MySQL are generally greatful.
    6. Re:I love my Yugo luge commute by LurkerXXX · · Score: 2, Informative
      For the last 2-3 years, MySQL has supported the full gammut of ACID features.

      Can we PLEASE stop beating this particular dead horse?

      First off, the grandparent implied ACID was worthless. Not me.

      When some idiot MySQL fanboy says ACID is worthless, I'm going to make sure anyone new to databases who reads the thread learns the truth.

      Secondly, MySQL fanboys keep talking about how great it is at speed, and the only way modern MySQL is significantly faster than modern Postgres is when you use the non ACID compliant MyISAM. InnoDB and strict mode slow MySQL down so that it's no faster than Postgres or other 'real' relational databases. (With a real relattional database 'strict' isn't an option. It's a mandatory part of being a real relational database.) Plus with Postgres you get real modern high-level database features.

      So to answer your question. NO. It's not dead yet.

  2. Avoid databases... by DreddUK · · Score: 5, Funny

    Honestly, just avoid this discussion by using flat files.

    --
    "If A equals success, then the formua is A=X+Y+Z. X is work. Y is play. Z is keep your mouth shut" - A Einstein.
    1. Re:Avoid databases... by spun · · Score: 5, Funny

      You kids and your fancy flat files. Back in my day, we kept our data in huge honking boxes of punchcards, and we were grateful!

      --
      - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
    2. Re:Avoid databases... by $RANDOMLUSER · · Score: 5, Funny

      You had boxes?

      --
      No folly is more costly than the folly of intolerant idealism. - Winston Churchill
    3. Re:Avoid databases... by beavt8r · · Score: 5, Funny

      We were supposed to keep that stuff?

    4. Re:Avoid databases... by Vraylle · · Score: 4, Funny

      Why, we used to DREAM of boxes and punchcards! In MY day we had to line up large stones into neat rows to represent binary. On a steep slope. In the middle of an earthquake. In Antarctica.

      --
      Mutant Freaks of Nature: "Frighteningly Addictive"
    5. Re:Avoid databases... by dextromulous · · Score: 5, Funny

      You had binary? We had to get about with only zeros, and some days we didn't even have those!

      --
      There are two types of people in the world: those who divide people into two types and those who don't.
    6. Re:Avoid databases... by Anonymous Coward · · Score: 3, Interesting

      PostgreSQL actually did used to be slower in most basic operations than MySQL. This was largely because MySQL used to lack some of the most basic things that make a DBMS relational (for example, for quite a long time there was no ACID compliance at all) whereas Postgres had them right from the start, but they weren't terribly efficient. As MySQL started trying to patch itself up into something a competent DBA wouldn't burst into flames over, PostgreSQL patched itself up to improve performance. The result was that they both basically got to the point where they were similar in features and performance.

      The question you have to ask, I suppose, is this:

      Would you prefer to have the patchwork system that made itself into a DBMS at some point after it's wide adoption, or the one that started out a relatively proper system and then just tweaked things to get performance gains?

      I'm not going to begrudge the MySQL people their choice, but I'll stick with PostgreSQL and MS-SQL instead, thanks. I remember MySQL's orginal state, and my distrust for its ability and the competency with which it was initially built still runs pretty deep.

      Regarding PHP: it's okay for moderate tasks and I use it, but I only use it because nobody else who's likely to maintain my code in the future seems to know any actual useful programming languages. If I thought I could trust future programmers to be reasonably competent with actual programming constructs (instead of just being trained to rely on the language to provide a function for every possibly thing you might need to do), I'd build everything in mod_perl with CGI::Application and a template framework instead.

      And if you think I'm a database and language elitist, you might want to reconsider your position: am I an elitist, or are you (not the OP, you the reader) just poorly informed about the underlying concepts of these two things?

    7. Re:Avoid databases... by rk · · Score: 5, Funny

      We only had ones because the zeros were too fat to fit through our tiny wires.

    8. Re:Avoid databases... by hullabalucination · · Score: 2, Funny

      huge honking boxes of punchcards

      We had punchcards but we didn't have keypunch machines. We had to take X-Acto knives and cut out perfect little tiny rectangles from each card by hand. Putting a simple 100-line program on cards could take over a year. I started my first programming class (Fortran 101) in 1974 and I'm on schedule to finish it next year. My first TA passed away seven years ago from old age.

      * * * * *

      Do not compute the totality of your poultry population until all the manifestations of incubation have been entirely completed.
      --William Jennings Bryan

    9. Re:Avoid databases... by DragonWriter · · Score: 4, Insightful
      Would you prefer to have the patchwork system that made itself into a DBMS at some point after it's wide adoption, or the one that started out a relatively proper system and then just tweaked things to get performance gains?


      Personally, I don't care what it used to be, I care what it is now. And, even if I did, I don't see how either course you describe is worse than the other. They are different development models, and depending on your needs the products will have very different advantages and disadvantages before they converge to both being relatively feature-complete and efficient, but generally neither is worse or better.



      Regarding PHP: it's okay for moderate tasks and I use it, but I only use it because nobody else who's likely to maintain my code in the future seems to know any actual useful programming languages.


      If you use it, and it works, and you have people that are more productive maintaining it than some other languages, it is, ipso facto, an "actual useful programming language".



      Now, it might lack features that you would find ideal in a perfect world where everyone shared your background and tastes, but that doesn't stop it from being actually useful.



      And if you think I'm a database and language elitist, you might want to reconsider your position: am I an elitist, or are you (not the OP, you the reader) just poorly informed about the underlying concepts of these two things?


      I've reconsidered. I still think you seem to be an insecure language and database elitist with a strong need to feel superior to everyone whose preferences differ from yours, and a deep resentment that your favored tools aren't always the most popular.


    10. Re:Avoid databases... by rocjoe71 · · Score: 5, Funny
      You had paper? We recorded everything on slabs of rock.

      ...When the system crashed, you knew it crashed. That's how we lost Ug, we really miss Ug.

      --
      Height: 38U, Weight: 0 Newtons, Eyes: #0000FF, OS: Gray Matter 1.0 (Alpha)
    11. Re:Avoid databases... by I+Like+Pudding · · Score: 5, Funny

      Pfft. I was a sysadmin for the Tower of Babel. When that thing divided by zero, man, nobody could even talk anymore.

    12. Re:Avoid databases... by paranode · · Score: 5, Funny

      You had stuff?

    13. Re:Avoid databases... by TheLetterPsy · · Score: 4, Funny

      You had?

    14. Re:Avoid databases... by CDarklock · · Score: 2

      This is a very good point to consider.

      Let's take the old adage "good, fast, cheap: pick two", and use that as our basis.

      Both PostgreSQL and MySQL chose cheap. PostgreSQL then chose good, while MySQL chose fast.

      Which approach is better? It's hard to say, but FAST benefits everyone, while GOOD benefits only the elite.

      From a pure business perspective, the choice to be fast was of greater benefit to more users, and hence should have been higher priority.

      --
      Microsoft cheerleader, blue flag waving, you got a problem with that?
    15. Re:Avoid databases... by Anonymous Coward · · Score: 5, Funny

      Back in my day, we no fancy verbs! And we it!

    16. Re:Avoid databases... by Anonymous Coward · · Score: 2, Insightful

      Nah, you're just too insecure to admit that there are actually ways to rank the functionality of these things. MySQL is good specifically in situations where you're going to do a lot of simple transactions on fairly simple data. That it's superior in that one, very narrow, situation, however, does not make it superior as an RDBMS or even equal to other software in the category.

      Likewise: PHP. PHP is an inferior programming language and that's that. It's good at RAD and it has a very gentle learning curve. That's it. That's all it's good at. Perl is a better language. C is a better language yet. That PHP is good in one narrow field does not make it superior or even equal in its category.

      It's really not that complicated of a concept. If you have two quarterbacks and one can throw the ball 75 yards consistently but can rarely get the ball anywhere near his receiver beyond five yards, he's very good at doing one particular thing, but he's still an inferior quarterback. That you get him out when you need an undirected hail mary does not make him an equal to the guy that carried the rest of the game.

      Contrary to what some people would like to believe, not everything is equal just because it does certain things well that other products do on a more average scale.

    17. Re:Avoid databases... by jalefkowit · · Score: 3, Interesting

      Amazingly this actually seems to be the approach lots of "Web 2.0" companies are taking. See Tim O'Reilly's database war stories series for details.

      Some quotes from that series:

      • Gabe Rivera of Memeorandum.com: "I didn't bother with databases because I didn't need the added complexity... I maintain the full text and metadata for thousands of articles and blog posts in core. Tech.memeorandum occupies about 600M of core. Not huge." [full story]
      • Mark Fletcher of Bloglines: "[T]raditional database systems were not appropriate (or at least the best fit) for large parts of our system." [full story]
      • Greg Linden of Findory: "We make thousands of random accesses to this read-only data on each page serve; Berkeley DB offers the performance necessary to be able to still serve our personalized pages rapidly under this load." [full story]

      The "databases cause more problems than they solve" sentiment was so pronounced in O'Reilly's interviews that he took the question to Brian Aker of MySQL for rebuttal, but ended up concluding that

      I didn't hear that flat files don't scale. What I heard is that some very big sites are saying that traditional databases don't scale, and that the evolution isn't from flat files to SQL databases, but from flat files to sophisticated custom file systems. Brian acknowledges that SQL vendors haven't solved the problem, but doesn't seem to think that anyone else has either.
    18. Re:Avoid databases... by DragonWriter · · Score: 3, Interesting
      Nah, you're just too insecure to admit that there are actually ways to rank the functionality of these things.


      No, I've admitted that, several times, in this thread.

      There are many ways to rank the functionality of things, not one correct way.

      MySQL is good specifically in situations where you're going to do a lot of simple transactions on fairly simple data.


      Which is, in fact, what a lot of web applications on LAMP infrastructure do.

      That it's superior in that one, very narrow, situation, however, does not make it superior as an RDBMS


      "Superior as an RDBMS" is mostly a meaningless, or at least equivocal and ambiguous, category.

      or even equal to other software in the category.


      Sure, in the sense that "different" is not "equal".

      Likewise: PHP. PHP is an inferior programming language and that's that.


      "Inferior programming language" is meaningless.

      It's good at RAD and it has a very gentle learning curve.


      And, in that, it is superior to languages that lack those features for uses where those are key features. Making it not unqualifiedly an "inferior programming language". Its like saying "A hammer is an inferior tool. It's good at driving nails, and that's it."

      Perl is a better language. C is a better language yet.


      There are certainly things for which C is better than Perl, and certainly there are things for which Perl is better than C. Your standard for saying that C is in some trascendent, unqualified sense "better...yet" compared to Perl is...what?

      That PHP is good in one narrow field does not make it superior or even equal in its category.


      True, again, because "superior" in the nonspecific sense you are using it is meaningless and, therefore, nothing could make anything superior in that sense.

      It's really not that complicated of a concept.


      It isn't a matter of complicated. It is a matter of wrong.

      If you have two quarterbacks and one can throw the ball 75 yards consistently but can rarely get the ball anywhere near his receiver beyond five yards, he's very good at doing one particular thing, but he's still an inferior quarterback.


      Really? If the other one can consistently hit a receiver out to 80 yards, but almost always fumbles the snap, I'm not sure if I could agree that the one you describe is "still an inferior quarterback": you can't label something inferior to something else when you describe the features of only one of the two things being compared. Further, the function of a quarterback on a football team is much more narrowly defined than that of a programming language or data storage solution, so it makes a lot more sense to talk about an inferior quarterback than an inferior programming language or datastore, without reference to a use for the latter.

      Contrary to what some people would like to believe, not everything is equal just because it does certain things well that other products do on a more average scale.


      I don't know what "some people" you are talking about, but I've never said "everything is equal". I would say that ranking tools without reference to application is generally meaningless except in the narrow case where the ranking holds without exception for all conceivable, or at least realistic, tasks.
    19. Re:Avoid databases... by crawling_chaos · · Score: 5, Funny

      Just be glad that you missed the 40 day and night core dump. Boostrapping a planet takes forever and they hadn't invented overtime yet.

      --
      You can only drink 30 or 40 glasses of beer a day, no matter how rich you are.
      -- Colonel Adolphus Busch
    20. Re:Avoid databases... by Gorshkov · · Score: 3, Funny

      And the lord said, "Let there be light!" And Moses, who was the chief electrician at the time, pulled the switch, blew the fuse, and fucked up the entire miriacle ........

    21. Re:Avoid databases... by paranode · · Score: 5, Funny

      You it?

      Maybe this too far...

    22. Re:Avoid databases... by paranode · · Score: 2, Funny

      Pssh, overtime? Try creating the whole thing in seven days and not getting paid!

    23. Re:Avoid databases... by nocomment · · Score: 4, Funny

      40 days would have been a vacation for us. We had to muck about for 40 years just trying to get the rain server going. For years it just rained bread, and the Manna pages were completely useless.

      --
      /* oops I accidentally made a comment, sorry */
      /* http://allyourbasearebelongto.us */
  3. So... by Richard_at_work · · Score: 4, Insightful

    If I 'emulate' enough features in the code, I can do away with both packages AND still get a performance boost. Probably. However, the whole point of having a seperate package do it is so I dont have to work more than needed.

    1. Re:So... by linuxwrangler · · Score: 3, Insightful

      Not entirely true true. The main point is to have your database contain known-good data. And not lose it. (Yes, you can boost PostgreSQL's performance by turning off fsync but most people are bright enough not to do this.)

      Ensuring data integrity requires a well thought-out design of table structures, primary/foreign keys, rules, triggers, etc. It also requires a database server that actually provides the tools required to implement your plan.

      Maybe Mr. PHP hasn't heard of Perl, Python, C, Java, Ruby and so on and thinks that databases are only accessed via PHP code written by careful talented programmers eager to reinvent database features. Maybe he doesn't think that people use ad-hoc tools like psql or PgAdmin. Sure, it's possible to re-implement some of the safeguards inherent in a good database design running on good database software. But only for that one piece of code.

      It's kind of like a homeowner who carefully installs one new energy efficient window, leaves all the others open, and then wonders why the heating bill is so high.

      --

      ~~~~~~~
      "You are not remembered for doing what is expected of you." - Atul Chitnis
  4. There ARE other scriping languages besides PHP ... by xmas2003 · · Score: 5, Funny

    "Rasmus Lerdorf, the creator of PHP ... said the current state of the Internet includes a litany of broken items, but with a little help from PHP there may well be some hope for the Web yet."

    I wonder if he has ever consider using Perl ...

    --
    Hulk SMASH Celiac Disease
  5. Let me be the first to say... by Mongoose+Disciple · · Score: 4, Insightful

    The creator of PHP thinks that PHP is #1 and all others are #2 or lower? Shocking.

    They say to a man with a hammer, everything looks like a nail. I'm sure it was even worse for the guy who invented the hammer.

    1. Re:Let me be the first to say... by syntaxglitch · · Score: 5, Funny

      But with PHP and MySQL, you can hammer screws much faster! :D

    2. Re:Let me be the first to say... by Anonymous Coward · · Score: 2, Funny

      They say to a man with a hammer, everything looks like a nail. I'm sure it was even worse for the guy who invented the hammer.

      Yeah but this is the guy who invented broken thumbs.

  6. wow by aleksiel · · Score: 3, Interesting

    he's quite full of himself, isn't he?

    the web is "broken" independant of the language used. bad/inexperienced developers are causing the problems, no matter what language is used. in order to not shoot yourself in the foot, you have to know that you're holding a gun and that pointing it at your foot and pulling the trigger are bad things to do.

    and mysql and postgresql are different. they both have strengths and weaknesses. you can hammer in a screw faster than using a screwdriver, but thats not the friggin point of it.

  7. Considering the source by grammar+fascist · · Score: 4, Insightful

    Considering that this is coming from the author of one of the worst hack-jobs of a language since Visual Basic, I'm going to have to give his opinions a pass. Pragmatism is great, but even Perl has principles.

    --
    I got my Linux laptop at System76.
  8. And We'd listen to the creator of PHP by Gr8Apes · · Score: 4, Insightful

    Why would we listen to the creator of a badly performing broken scripting language about a reliable performance oriented DB?

    Not the whole world is interested in rendering HTML tables with blathering text.

    --
    The cesspool just got a check and balance.
  9. Moo by Chacham · · Score: 5, Insightful
    FTA:

    "The Web is pretty much broken, we can all go home now," Lerdorf said somewhat sarcastically to the capacity crowd. "Luckily most people don't realize that it's broken."
    Header "stupidity," as Lerdorf referred to it in Apache HTTP Web server, can also be the root cause for the broken Web.
    "IE is completely broken in so many ways," Lerdorf said.
    This guy is an idiot. PHP is a nice product though, if anyone can get past its inconsistent function naming schemes.

    He also states:

    "You have to filter everything and then poke a few holes to let things through, "Lerdorf advised.
    He *just* learned that? Oh my, that's scary.

    "If you can fit your problem into what MySQL can handle it's very fast," Lerdorf said. "You can gain quite a bit of performance."
    MySQL is made for speed compromising to act like a database where it does not break its own convenience. PostgreSQL is a database which will compromise for speed, if it does not break the database.

    From someone who obviously is suprised that to secure something you need to make a safe-house and then be strict about what gets in, it seems that he missed the point on the MySQL/PostgreSQL thing.

    Maybe by the next conference he'll grow up and state the new revelation "You have to use a database like PostgreSQL and use a warehouse schema to allow faster reporting."

    ====

    Nor was this a "slam". PostgreSQL is not made for specifically web use. If anything, Lerdorf merely publicly demonstrated his own immaturity.
    1. Re:Moo by masklinn · · Score: 2, Interesting

      PHP is a nice product though, if anyone can get past its inconsistent function naming schemes.

      And 3000 redundant functions, and absence of namespaces, and stupid syntax (does ANYONE know why PHP uses $prefixed names? I mean they make sense in Perl or Ruby because they have a meaning, but in PHP?), and the completely stupid misfeatures (register_globals or magic_quotes) which generate as many security holes (flash news: the web is mostly broken because of PHP), and retarded implementations of new features (yeah PHP finally having OO may be great, but Java's OO model just isn't fit for a dynamically weakly implicitely typed language)

      Lerdorf is an idiot.

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    2. Re:Moo by nuzak · · Score: 2, Insightful

      > does ANYONE know why PHP uses $prefixed names?

      Consistency I suppose, since you need the $ to interpolate in a string (which PHP doesn't even manage to do inside HTML without special escape brackets, where velocity and TT2 actually does). You can also call functions through variables that name them, e.g. $foo() so you need the $ to dereference it. You may as well use $ for dereference in all contexts at that point.

      Not that I think that much logic actually went into it. Heck, does it still deep-compare objects by value or did they fix that awesome misfeature in PHP5 now that it actually does the super-advanced thing of passing objects by reference now?

      Back on topic, I wonder how Rasmus thinks his mealy-mouthed talk goes over to anyone but his fanbase? Is he a developer or a politician?

      --
      Done with slashdot, done with nerds, getting a life.
    3. Re:Moo by 14CharUsername · · Score: 4, Insightful

      Wow I didn't get that at all. Yeah the writer of the article tried to slant it that way but thats just a typical journalist trying to sensationalise an otherwise boring story.

      First of all he was pointing out that its a mistake to trust any data from the client. Pretty obvious, but there are a lot of sites that ignore this. He didn't "just learn that", he is pointing that a lot of developers haven't learned it yet. And unfortunately this is all too true.

      You yourself admit "MySQL is made for speed compromising to act like a database" and that is exactly what he is saying too. See, if you're web app doesn't require a full featured database, ie. "If you can fit your problem into what MySQL can handle", then Mysql is a good choice for performance reasons. And even if there's one or two features you need that Mysql doesn't support, then you can do a few hacks to make it work anyway and still be ahead performance-wise.

      Nor was this a "slam". PostgreSQL is not made for specifically web use. If anything, Lerdorf merely publicly demonstrated his own immaturity.

      I don't think he was intending to slam PostreSQL. He was only saying that MySQL has better performance for web apps than PostGreSQL, which you seem to agree with. He didn't say MySQL is better than PostgreSQL, he just said it gives better performance for web apps, and even added the caveat "If you can fit your problem into [it]".

      What he is really talking about is the classic problem of elegance vs. performance, a dilemma programmers constantly have to grapple with. Postgres is more elegant, but Mysql has better performance in its niche.

      The writer sensationalised it all a bit and then slashdot turned it into a troll. A mature reader would see through that and pay close attention to things actually between quotes, the things the dude actually said.

    4. Re:Moo by 14CharUsername · · Score: 2, Insightful

      Yeah, for those rare cases where consistency isn't important. That covers almost every web app.

      See, consistent data is pretty moot in most web apps. I can store the location of an image and then, oops, someone deletes the image file. What's the result? Well technically the data is still consistent within the database, all my foreign keys check out and everything. But I still end up with a broken web page.

      So I have to write some code somewhere to make sure that all the images my database points to are real existing images. And then I'll have to so that for the hyperlinks too, nobody likes broken links. Oh and if someone renames a page in the database, we should make sure the address for the old page redirects to the new address.

      With all that going on, do you really think data consistency is that big of a problem? Come on, writing a few scripts to make sure data in the MyISAM tables is dead simple. I mean really, really, really simple. I wish all my problems could be solved so easily.

  10. Rather incomplete quote by Rasmus · · Score: 5, Informative

    You are basing this on a rather incomplete account of my actual talk. I went through a series of optimizations of a sample Web application, and one of many steps was to try MySQL instead of PostgreSQL for that particular application. By profiling it with Callgrind it was obvious that in this particular case MySQL was significantly faster. I don't think this is news to anybody that MySQL is quicker at connecting and issueing simple queries, and I am not sure why me showing some Callgrind profiles and stating that MySQL is particular good at these things is frontpage slashdot material. Slow day?

    And the "The Web is broken and it is all your fault" thing was just a bit of humour to wake people up for this 9am talk, but I guess it makes for good headlines.

    1. Re:Rather incomplete quote by Rasmus · · Score: 5, Insightful

      By the way, the "emualting PostgreSQL features in PHP" part was completely misquoted. I was explaining how MySQL's internal prepare/execute API is rather broken because if you use it you completely miss the query cache, so my suggestion is to turn on prepare/execute emulation in PDO while behind the scenes it will use the faster direct query api calls and thus will also hit the query cache. So this was actually a bit of a MySQL slam which was utterly misquoted. Trying to emulate PostgreSQL things in userspace PHP would be moronic.

    2. Re:Rather incomplete quote by drinkypoo · · Score: 2, Insightful

      So since you stepped in here for some abuse :) don't you think that putting application logic in your program instead of letting the RDBMS handle it makes for a less-maintainable program?

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    3. Re:Rather incomplete quote by Azarael · · Score: 2, Interesting

      :) Read his 2nd comment, above. You aren't emulating the behavior in your program, but letting one of php's db abstraction libraries handle it for you.

    4. Re:Rather incomplete quote by Rasmus · · Score: 4, Informative

      Sure, the more you can offload to the database, the better. Like I said, my point about emulating things in PHP was directed at MySQL's broken query cache implementation when using the prepare/execute API.

    5. Re:Rather incomplete quote by Rasmus · · Score: 5, Informative

      Once again, I never said it was a good idea to "code around the features of PostgreSQL". I didn't write the article. I gave a talk at a conference. Someone was in the audience taking rather bad notes apparently, and he posted these notes as an article. What I showed was that if your problem fits what MySQL is good at, there are significant performance benefits from using it. It wasn't a PostgreSQL slam in any way. It was a "profile and choose the best and fastest tool for the job" statement.

    6. Re:Rather incomplete quote by Savage-Rabbit · · Score: 3, Insightful
      By the way, the "emualting PostgreSQL features in PHP" part was completely misquoted. I was explaining how MySQL's internal prepare/execute API is rather broken because if you use it you completely miss the query cache, so my suggestion is to turn on prepare/execute emulation in PDO while behind the scenes it will use the faster direct query api calls and thus will also hit the query cache. So this was actually a bit of a MySQL slam which was utterly misquoted. Trying to emulate PostgreSQL things in userspace PHP would be moronic.

      I wish the people writing the news summaries here would tone down their appetite for sensationalism. We all like to have a nice friendly anti Microsoft flamewar-deathmatch every once in a while just for fun but headlines like 'PostgreSQL Slammed by PHP Creator' sound like they were written by a member of the British tabloid press. Can't people voice some criticism without getting gutted any more? And, no, I am not new here I'm just getting a little tired of the fanboyism.
      --
      Only to idiots, are orders laws.
      -- Henning von Tresckow
    7. Re:Rather incomplete quote by Karma+Farmer · · Score: 4, Insightful

      You're kidding, right? In this case, Slashdot was directly responsible for distributing the hearsay of hearsay in the first place.

      It's pretty routine to have a just plain wrong articles on the front page of Slashdot, and posts pointing out the editor's idiocy buried deep in the comments. It's amazine to me that you think this is a positive thing.

    8. Re:Rather incomplete quote by Rasmus · · Score: 4, Informative

      It is getting to be rather annoying. A quick email asking me whether the article was an accurate representation of what I actually said would certainly have been more useful, but instead the poster chose to go the other way and focus on the misquoted bits of the article. I have been doing this stuff a long time and have been slammed on /. countless times, but please, slam me for things I actually said or did.

    9. Re:Rather incomplete quote by azterix · · Score: 2, Insightful

      The contributor of this article should be ashamed of his/herself for the sensationalized, misleading title. And - /. mods - you there? Did you read the article before posting this to the front page? Hardly an accurate depiction.

      The presentation that Rasmus gave showed some very, very powerful tools for profiling & improving PHP performance. The MySQL/PostgreSQL comment was barely a footnote on a presentation of tools that deserve the positive attention that Rasmus gave them.

      "The web is broken and it is all your fault" comment was completely taken out of context. I took it as a challenge to the majority of web developers out there that are ambivalent to security and practices that represent a challenge to our profession. Anybody hear this thing folks are talking about called 'identity theft'? We as web developers have a responsibility to our customers and end users to protect the data they share with us. Rasmus was presenting to improve awareness of both the technical vulnerabilities as well as tools & techniques to address the problems we face. It's a shame that those messages didn't reach the slashdot community.

      Seriously, check out the tools that were the focus of Rasmus's presentation: valgrind, callgrind & kcachegrind - they are amazingly powerful.

    10. Re:Rather incomplete quote by slamb · · Score: 3, Insightful
      I went through a series of optimizations of a sample Web application, and one of many steps was to try MySQL instead of PostgreSQL for that particular application. By profiling it with Callgrind it was obvious that in this particular case MySQL was significantly faster. I don't think this is news to anybody that MySQL is quicker at connecting and issueing simple queries

      It's news to me. I haven't seen a recent benchmark that says this, and I'm always skeptical of claims MySQL is faster:

      • Were you using MySQL as an ACID database? I.e., all tables using a transaction table type, fdatasync() on, real tests telling you that durability is actually working? If not, either run it properly or run PostgreSQL in stupid mode for something approaching an apples-to-apples comparison. fsync = off in $PGDATA/postgresql.conf.
      • Were you using MySQL's query cache? Turn it off. It shows bigger numbers on some bad benchmarks but doesn't help real situations: artificially claims silly numbers for tiny sets (are your real data as small as your benchmark?), cleared after every DML statement on that table, etc.
      • For that matter, did you issue any DML statements at all? As the bullet point above mentions, they have much greater impact on performance than their proportion would suggest. For other reasons, too. Doesn't MySQL still just have table-level locks? PostgreSQL's the other extreme; it has MVCC.

      Seriously, if you can prove MySQL is faster for a real-life situation, write a paper, lay all your steps out for review. (Or point me at one someone else has done on modern versions of said databases.) There are lot of potential mistakes in benchmarking, and I won't believe claims unless I actually see that none of them were made.

      By the way, what were you saying about Apache header stupidity? The article is annoyingly vague.

    11. Re:Rather incomplete quote by slamb · · Score: 2, Insightful
      have been doing this stuff a long time and have been slammed on /. countless times, but please, slam me for things I actually said or did.

      Sure thing. Did you say this?

      Part of the reason Lerdorf considers the Web "broken" is that it is inherently insecure for a variety of reasons. One of those reasons sits at the feet of developers. "You don't know that you have to filter user input," Lerdorf exclaimed.

      If you don't like insecurity due to poor input handling, why did you design your language to encourage it? magic-quotes-gpc is the worst language feature I have ever seen. It manipulates one particular set of inputs to make them conform to one set of output which doesn't always apply but is always a bad idea. People should be using bind variables supplied by the database library, not quoting according to MySQL x.x's rules and then sticking things directly into their statements. This is like a giant neon sign called "Security" pointing in the opposite direction from the real thing.

      In contrast, Perl has taint mode, a feature you'd do well to emulate. It actually tracks a flag on each variable seeing if it came, directly or indirectly, from untrusted input. If so, it must be untainted before being used in any of a number of security-related situations. It's smart enough to avoid requiring any way of doing so which is probably inappropriate. It just flags things which are almost certainly wrong. Actual thought needs to go into correcting them, and as users learn the situations taint mode complains about, they trip it less and less often. Correct taint-mode code runs the same with it off, which makes it much superior to magic-quotes-gpc.

    12. Re:Rather incomplete quote by Rasmus · · Score: 3, Interesting

      That was a reference to the Expect header problem in Apache that was recently fixed and that not all the problems can be blamed on IE.

      And yes, I do know my way around PostgreSQL. It's a good database, but no matter how you tweak it, it still has more connection overhead than MySQL does. And as I explained, I wasn't actually using the query cache in MySQL in the initial steps in this iterative optimization because MySQL's query cache doesn't kick in for prepare/execute queries. This isn't a PostgreSQL slam, it is simply pointing out that people should benchmark and profile their actual applications and understand the costs.

    13. Re:Rather incomplete quote by slamb · · Score: 2, Insightful
      Yes, of course I showed how persistent connections improved things as well. That was an early step.

      Okay...so is that what you were talking about here?

      It's a good database, but no matter how you tweak it, it still has more connection overhead than MySQL does

      If so, why are you complaining about something that has no significance? If not, what are you talking about?

    14. Re:Rather incomplete quote by SanityInAnarchy · · Score: 3, Interesting

      You are right, you were quoted out of context on at least a couple of things. And you probably had some insightful things to say, so I'm just going to use this as an excuse to rant:

      What I find especially annoying is that it seems that the Web is more broken because of PHP than in spite of it. Valid to wake people up to a 9am talk -- when you're presenting Ruby to a PHP conference.

      My own personal gripes are:

      • While it's possible to call $self->method() from a method (or maybe that's $this->method?), if your function is called as a static class method, it has no way I've found of discovering what class it's in. Yet, you're forced to call static class methods as MyClass::Method. This defeats the main purpose of using a class as a namespace -- you still end up with your namespace referred to throughout the code, meaning you still have to use grep to change it, which can be unreliable.
      • The syntax, in general, is clumsy at best. It basically feels more or less like any other C-like language. But this is web programming. I thought we were taking a speed hit to make things easier. I like Perl, Python, and Ruby for tons of syntactic sugar that PHP never had. preg_match is definitely clumsy when compared to =~.
      • In order to access a global variable, I must have a line that says "global $variable". Forcing people to declare a variable is good, it means you'll probably notice your typos. If you're declaring a variable anyway, it saves a lot of typing, especially if you're using lots of tiny functions, to do this the Perl way -- say "my $variable" if you want it to be local, and just say "$variable" if you want it to check for a global one first.
      • Prefixing every variable with a $ doesn't seem to serve any real purpose. Ok, so I can have a variable called $variable and a function called "function". I could do that anyway. It means you don't have to define variables to use them -- same with Ruby, except Ruby doesn't use prefixes. Perl uses prefixes, but it also uses them for interpolation in strings -- I don't think PHP can do that. Ruby manages that interpolation without prefixing variables except when they're in a string.
      • Not a lot of scope choices. In fact, there seems to only be method scope and global scope, and maybe loop scope (foreach and friends), unless I'm missing something. What I miss is easy access to, say, class scope and object scope.
      • A history of being seen as the easiest language for web programming, to where now many think "web backend programming" is always PHP, means you have lots of clueless newbie web programmers. The advantage of PHP was being easy to learn and having some nice features for web programming, but many of these (register_globals, anyone?) have been found to be security flaws, and are no longer reasons to use it. Yet, and I know this isn't your fault, given the choice between a PHP app and a Python|Perl|Ruby|C|ASP app, I won't choose PHP, because PHP developers tend to be the ones who say "If our app gives you security errors, just chmod 777..."

      To be fair, I have found some advantages:

      • Easy insertion of HTML code. This is nice for developing an app quickly. I still don't find it too incredibly useful in larger apps, though, because it makes more sense to split most of the HTML out into a separate file, and generate the rest, maybe even through some XML API.
      • Powerful templates. Being able to embed real code into a mostly HTML template is a beautiful thing. And yet, I find myself both wishing it was a more powerful language, and thinking a better design (separating logic from presentation, using an existing template engine) would be better than what PHP offers.
      • Good apps. As much as I hate the poorly-written PHP apps, I'm starting to work on Drupal... In this way, apps are a bit like game consoles, you get the one that plays the games you want. I think PHP attracting newbies probably leads to more decent web apps being written in PHP than in o
      --
      Don't thank God, thank a doctor!
  11. Pot, kettle, black? by A+beautiful+mind · · Score: 3, Insightful
    "You don't know that you have to filter user input," Lerdorf exclaimed.
    Apparently the much belowed MySQL doesn't know it either, since in contrast to most standard SQL relational databases like Postgresql, it silently trims certain input/fields instead of reporting an error.

    While people might not agree with me that PHP is horribly broken, I think we can all agree that if we were to choose between Apache, PHP and Postgresql as to what made the web more broken, I think almost everyone would pick PHP. The reason can be summed up as bad design decisions in PHP (slashes, inconsistent naming, header fun, etc.).

    I don't blast someone if they choose the smaller learning curve with PHP + Mysql, but they're certainly not the superior solution compared to for example Perl/Python + Postgresql/Oracle.
    --
    It takes a man to suffer ignorance and smile
    Be yourself no matter what they say
    1. Re:Pot, kettle, black? by kwark · · Score: 2

      "Apparently the much belowed MySQL doesn't know it either, since in contrast to most standard SQL relational databases like Postgresql, it silently trims certain input/fields instead of reporting an error."

      Might you be looking for: http://dev.mysql.com/doc/refman/5.0/en/server-sql- mode.html ?

  12. I want to move from MySQL by Anonymous Coward · · Score: 5, Insightful

    I've used MySQL on several projects. At first because we didn't know any better, later because it was the thing we knew best, or because the project was already using it when I joined it. Inertia. We're using a 5.0.x now, on a setup where we replicate to six slaves, it's not small.

    I knew that MySQL could do stupid things now and then, but at least it was our stupid thing. We have some experience with it, by now.

    Recently though, some colleagues on another project had an issue with major data loss - an input script had put data into the database that wasn't really compatible with the data model.

    Turns out that in a table with an auto-increment primary key named 'id', some of those ids occurred over 200 times. A primary key.

    I don't care if there's options or ways to have it check that, even without "emulating it in PHP" (shudder) - anything that is even considering putting "SQL" in its name has to complain loudly when someone tries to insert such crap, and then abort. Not just silently accept it.

    That's the eternal problem with MySQL - everywhere, the default action on wrong input is to silently continue, perhaps trying to read the mind of the programmer and turn the nonsensical value into some equally nonsensical default. Put a string into an int field? Let me guess what you meant... etc.

    I've had it, I don't want MySQL anymore.

  13. Re:There ARE other scriping languages besides PHP by Billosaur · · Score: 3, Interesting

    I've been writing Perl for 6 years now and I've yet to find a more versatile language. I just started working in PHP, and it's Perl-like enough that learning it has been easy. But some things are just not done elegantly, and one has to wonder why that is, given that PHP is in fact pretty good as languages go.

    --
    GetOuttaMySpace - The Anti-Social Network
  14. PostgreSQL "Slammed" you say? by tjw · · Score: 5, Insightful

    The headline implies that Rasmus blames PostgreSQL for breaking the web which is not the case. The focus of his ire is web application programmers for putting too much trust in user input. I don't think anyone can truthfully argue with that.

    His comment regarding PostgreSQL was:

    "If you can fit your problem into what MySQL can handle it's very fast, you can gain quite a bit of performance."

    As someone who uses both MySQL and PostgreSQL in production environments, I couldn't agree more. The key qualifier is "If you can fit your problem into what MySQL can handle". In order to argue that this statement is wrong you would have to argue that PostgreSQL is faster than MySQL in situations that are ideal for MySQL.

    --

    XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UB E-TEST-EMAIL*C.34X
  15. Who cares? use ORM. by profet · · Score: 5, Informative

    I got sick of the syntax dialects of every SQL engine, so I started writing my applications using Hibernate and haven't looked back.

    I learned HQL (Hibernate Query Language) and just use whatever database is handy at the time.

    I usually start with MySQL 5, and then if I need more muscle (Read: the boss wants to spend money), I can switch the entire application to Oracle in about two hours.

    You want ACID...? Use J2EE transactions and Hibernate, and never worry about which database you use again.

    1. Re:Who cares? use ORM. by Deinesh · · Score: 3, Insightful


      You want ACID...? Use J2EE transactions and Hibernate, and never worry about which database you use again.


      Yes. But shit happens. It is always nice to have a relational database that GUARANTEES data integrity. You should not depend on the application for maintaining data integrity - all applications have bugs and you don't want those bugs thrashing your data. You shouldn't completely depend on the framework for transactions - even Websphere has bugs.

    2. Re:Who cares? use ORM. by Richard+W.M.+Jones · · Score: 3, Interesting
      Who are these people who change databases all the time? We just figured that PostgreSQL was the best, it's free, we know how to use it and tune it, and so that's all we ever use. Now we can use all the wonderful SQL features of PostgreSQL and not worry.

      A solution which forced us to regress to using Java or .Net is no solution at all BTW.

      Rich.

  16. Pot and Kettle by markbthomas · · Score: 3, Funny

    "'The Web is broken and it's all your fault' says Rasmus Lerdorf, the creator of PHP."

    Translation:

    "Hello, Kettle? Yes, this is Pot. What colour are you..?"

    Really, if Lerdorf wants to know who broke the web, he just needs to look in a mirror.

  17. Re:There ARE other scriping languages besides PHP by Rasmus · · Score: 5, Informative

    PHP/FI was the second version, and it wasn't written in Perl. Neither was the first version. The first version of PHP replaced some Perl code which may be where this myth comes from.

  18. It's entirely a matter of appropriateness by kahei · · Score: 3, Insightful

    Recently, I've been using Drupal (PHP CMS system) with a MySQL backend and I am STUNNED, STUNNED I SAY by how productive the combination is compared with, say, ASP.NET and SQL Server. It's a messy, awkward, ambiguous and utterly unscalable language with a cluttered global namespace stuffed full of magic variables and near-identical functions -- combined with a 'database' that simply does not do what a proper database does. And I love it!

    I don't understand this compulsion to prove that PHP and MySQL are good. They're not good. They're sh*t. They're extremely old fashioned and underpowered solutions to problems that are already solved far more effectively in the MS world AND in the OSS world AND even in the proprietary Unix world. Every time I poke around in the Drupal source I have a little smugness session as I think how much clearer and more efficient and more cleanly extendible it could be in C#, or even Java. Then I go right back to using it -- not because it's good, but because for the size of task I'm using it for, it's productive.

    Sure, SQL Server is better and so is PostgreSQL, and sure, the antics of LAMP people to prove that PHP and MySQL (and CVS, for that matter) are real grown up systems are laughable. But so what? I'm not trying to be scalable or extensible or secure beyond very narrow parameters that I already know fall within the limited scope of PHP and MySQL. I don't want to use the best tools; I'm familiar with the best tools and the scale of operation they best suit. When I want the following methodology:

    GET
    gunzip
    tar -xvf
    vim vim vim
    exit ...I want PHP and MySQL!

    (end of long meandering rant)

    --
    Whence? Hence. Whither? Thither.
  19. The real story here... by Anonymous Coward · · Score: 3, Informative
    PHP 6, which is still in development, will have opcode cache built in by default.

    For current PHP 5 users, there are various opcode cache implementations that can be used, including the Alternative PHP Cache (APC), which is what Lerdorf recommended.


    APC is broken in so many ways it is unbelievable.

    eAccelerator however performs a thousand times better and actually works.

    Ever new major php build makes noticeable efforts to break eAccelerator while making concessions to APC.

    It is very frustrating. APC just plain sucks. eAcclerator rocks.
  20. Where's the slam? by Abu+Hurayrah · · Score: 3, Interesting
    One performance enhancement that Lerdorf suggested based on code analysis was to use MySQL instead of PostgreSQL for the database. "If you can fit your problem into what MySQL can handle it's very fast," Lerdorf said. "You can gain quite a bit of performance." For the items that MySQL doesn't handle as well as PostgreSQL, Lerdorf noted that some features can be emulated in PHP itself, and you still end up with a net performance boost.
    There's your "slam". Hardly a revelation, really. MySQL & PostgreSQL are two excellent databases that have different target audiences that overlap somewhat. I guess there are different kinds of extremists out there as well...
    --
    Kindness is not to be found in anything but that it adds to its beauty...
  21. Re:But this is for a database by sachar · · Score: 2
  22. Say it ain't so by Von+Rex · · Score: 2, Funny

    Are you saying a Slashdot editor didn't bother to fully read the article and just made up a sensational and misleading headline in order to troll for mouse-clicks?

    I don't believe you.

  23. Re:There ARE other scriping languages besides PHP by Anonymous Coward · · Score: 2, Funny

    I've been writing Perl for 6 years ....

    Anyone else misread this as "I've been WAITING for Perl 6 for years"?

  24. MySQL's problem by Doctor+Memory · · Score: 3, Insightful
    the eternal problem with MySQL
    I think the eternal problem with MySQL is that everyone thinks that just because "SQL" is in the name it's a relational database. It's not. Sure, it's got tables and you can join tables together and use SQL queries, but it wasn't originally designed to do the things that a relational database must do. It was designed to be a quick, easy-to-use database that made developer's lives easier. And from that standpoint, it does well.

    FWIW, the commercial database UNIFY used to be pretty much the same thing back in the mid-80s. They had a wicked-fast ISAM database, and then they wrapped that all up in an SQL wrapper. They were a little more concientious, though, so you had guaranteed atomic transactions and rollback capability and more complete SQL support (e.g., nested/correlated subqueries), so it was truly relational (as the term is generally used). Horrible syntax-based optimizer, though (actually, I'm not even convinced it was an optimizer, it was probably just the way their SQL parser interpreted the query).
    --
    Just junk food for thought...
  25. and php is not broken? by paulpach · · Score: 2
    This guy has some b*lls, I have had the displeasure of using php for a couple of years.

    Here is a good summary of some of my complaints. But wait, there is more:

    As a programming language, php is extremelly poor. Off the top of my head:

    1. Very poor object oriented language. Not everything is an object, no multiple inheritance, use destructors and you get segfaults, etc... They improved a lot with v5 but still.
    2. No higher order functions. As opposed to Python, Perl, Ruby, and hundred others.
    3. No closures
    4. No operator overloading
    5. No aspect oriented constructs, metaclasses, decorators, nada

    and then there is the issue of all the weird behaviours it has

    1. consider this code:
      $x = NULL;
      $x->a = 10;
      What do you expect to happen? well, an exception obviously. NOT, php guesses you really meant to create an object, assign it to $x and that the object has an attribute a. It does not even issue a warning in the logs. Makes it really fun to debug some programs.
    2. References are just weird. And they are so different from version 4.0 to version 5.0 that it made it imposible to upgrade for an existing project
    3. arrays are passed by value, but objects are passed by reference, WTF?
    4. variables are case sensitive, but methods are not. WTF?

    The language itself seems to promote what Rasmus calls "broken" code. Magic quotes are just an open invitation for SQL Injection, and XSS vulnerabilities.

    For fck sake, the php tutorial teaches how to write cross site script vulnerable code which is what Rasmus is complaining about. WTF?????

    P.S. Forgive my grammar, english is my second language

  26. Huh? by 93+Escort+Wagon · · Score: 5, Funny

    "just like you can get better performance from a wheel-less Yugo if you slide it down a luge track."

    I am sick and tired of seeing these sweeping, baseless statements on Slashdot. The body of a Yugo is much too wide to sit flat on the ice of a luge track.

    Editors, please start doing some fact checking before posting this stuff.

    --
    #DeleteChrome
  27. Re:Postgres by mlwmohawk · · Score: 2, Informative

    The feature you are talking about is vital to the proper operation of a real database. The "transactional reasons" you refer too are the difference between a "real" database and a toy like "mysql" (which is neither yours nor very good SQL) Imagine two operations concurrently operating on a database, one in the process of modifying the data, the other simply reading it. The first process starts a transaction and makes a lot of changes, then commits the changes. The second query just wants to execute a quick query. The second query gets its data and is done. When the first operation finishes, its changes become available. No one had to wait for anything. In MySQL, the second query would have to wait. As we see in so many MySQL web sites, as the waiters pile up, sooner or later you run out of MySQL connections and start to get error messages. IMHO, one of the reasons why the web is broken is that it is so easy to create content that no one takes the time to learn the basic computer science involved. When things break or perform poorly, they blame everyone but themselves. There is REAL science in computers, if if you ignore it, you'll never do anything worth while.

  28. Summary of article by bonch · · Score: 3, Funny

    "PostgreSQL sucks." - From the guy who brought us magic quotes

  29. Re:He did *NOT* slam PostgreSQL by Rasmus · · Score: 3, Interesting

    Exactly. But it makes a much more interesting /. story to take an imcomplete account of a talk and further mangle it.

  30. Re:There ARE other scriping languages besides PHP by finnif · · Score: 3, Insightful

    I've been writing Perl for 6 years now and I've yet to find a more versatile language.

    I've been writing in Perl for 13 years and detest supporting the crap code written by people who think it's applicable to every problem domain.

  31. One word: by Si · · Score: 4, Insightful

    SQLite.

    --


    Why is it that many people who claim to support standards have such atrocious spelling and grammar?
  32. Mod Post -1 Troll by RaisinBread · · Score: 3, Insightful

    Isn't this flamewar old enough for people to start ignoring it? Holy cow: the mySQL vs. postgres argument has been hashed and rehashed so long... isn't about time we realized that neither is a clear all-encompassing winner over the other?

    1. Re:Mod Post -1 Troll by mlwmohawk · · Score: 2, Funny

      That's just the thing. MySQL loses on all technical merits, yet the pro-mysql mob refuse to be reasonable. :-)

  33. Re:But this is for a database by theshowmecanuck · · Score: 2, Informative

    They do. And unfortunately I have direct experience with these people... and for the record, I *mostly* hate it.

    Where I work, some of the architects and designers have decided to store more than a little XML in Oracle tables. In some cases this is not an entirely onerus decision (i.e. can make sense). e.g. if you are storing standardized configuration information in XML that will be queried as a string from the table and can be used by/passed to different consumer services/applications as an atomic unit (and which is not used in whole or in part as an sql 'where' predicate), then it can work.

    However any time you may need to query information contained in the XML string, it seems to me to be kind of retarded to store it in a relational table. e.g. I have seen cases where IDs or service types etc. are stored in a large XML string in a field in a record, and eventually someone wants to retrieve a record based on that ID which is in the XML. This means parsing the field storing the XML in your query, killing any chances on performance since you are likely going to need a 'like' clause with wild cards at the front and back of the search term (even if the RDBMS has a built in XML search tool, the field still needs to be parsed). Unfortunately, people buy in to XML so much that some think that it is still OK to store XML in database tables... even in these cases.

    I personally think it is generally a bad idea to store XML in a relational database as eventually the 2nd situation will come about (that is what experience tells me). You will then find that the practice totally negates the benefit of a relational database and sql (language) to easily and quickly retrieve relational data. I have seen this bite people many times. Ahhh... to use a technology, even a useful one, just because it is hip... but that is just my experience.

    --
    -- I ignore anonymous replies to my comments and postings.
  34. Depends what you are doing... by alexhmit01 · · Score: 4, Insightful

    PHP through 4.1 was an AWESOME prototyping language... what it was designed for. Back then, you could POST or GET a form, and the variables were automatically filled in. This was a huge security whole, and therefore plugged, which has made it less useful in some ways, but more production friendly in others.

    However, my old partner when to a PHP conference, and was STUNNED that the recommended course of action was:
    1. Use PHP to prototype
    2. Move all business login into C or C++
    3. Call the business logic from PHP wrapping the C/C++ calls

    While that may be more "correct," that would have massively increased development time.

    Our current cycle is like this:
    1. Prototype in PHP and PostgreSQL in a test database, treating it like MySQL or Access (a retarded database)
    2. Move all validation code into the database with pl/pgSQL, using triggers, etc
    3. Performance tune by creating (using triggers) optimized tables for the live site.
    4. Deploy

    This gets us a lightening fast, reliable system. Unfortunately, for legacy reasons, we have so much PHP code that we've written that migrating to something else (including PHP 5) is hard to justify until we have the budget to get the extra staff just to migrate the system.

    It's more work on the DB side, but it's well worth it.

    One of the performance tunes we've considered: pl/php, which last time we evaluated it, wasn't quite ready for prime time. Our idea: after tuning your database, move all your database access into the database.

    Essentially, for each "page type" on a dynamic site, create a php function that gathers ALL the data you need and puts it into an array. Then, call the Database PHP function getPageType("values to be passed"). The server side PHP function will do all the queries you need, serialize the array, and return it as a TEXT value. Your web page deserializes and displays.

    The reason for this is that you have several delays and resource hogs:
    1. unoptimized queries: before you move things to stored procedures, test your SQL with explain. Add indexes as needed. If you look up on two or three values, create an index on those values... basic stuff, but will get you massive speed-ups.
    2. database connections, to keep this down, put everything on the server into one database and use schemas for access, now you can use persistent connections with a "web" user that connects in persistently and switches as needed (or make your getPage functions accessible to the web user... SECURITY definer, grant execute to the web user).
    3. back-and-forth connections: the best way to kill performance, have a PHP script that calls the database, gets some data, calculates on it, and queries again... the fewer queries to the database a page, the better, less overhead. If you need to do back-and-forth activity, write a stored procedure, then there is a single database call. PostgreSQL lets you write stored procedures in SQL, so there is no excuse not to do it.

    If you are doing a project of any magnitude, (i.e. 2-3 programmers on it), then one of you should learn to play DBA and optimize the database. If you do that, PostgreSQL is a fast moving beast.

    Most performance competitions are MySQL users testing PostgreSQL. However, if you use PostgreSQL like MySQL, it's dog slow. MySQL is a "retarded" database with almost no overhead, so querying the database 15-20 times on a page is harmless. PostgreSQL requires database administration. Once you set up your database right, and tune the server settings (increase buffers, allocate more sort memory, etc.) it screams, but you have to treat it like a real DB.

    If you are just throwing your thoughts up on the web, it's not worth it, but if you are doing a real "small" project, where the license for Oracle, DB2, or even MS SQL Server would be extravagant, PostgreSQL is a great option. (The problem with the real databases isn't just the price tag, it's that they are more powerful IF configured right, so you end up needing a 6-figure DBA, instead of a book on database design and about 12 hours to get used to writing triggers).

    Alex

    1. Re:Depends what you are doing... by blueskies · · Score: 2, Insightful

      Does it run under Linux like the rest of my core infrastructure?

  35. XSS wtf? by paulpach · · Score: 2, Funny

    Excuse me Rasmus, but aren't you teaching how to write XSS vulnerable code in your php tutorial?

  36. Re:Postgres by mlwmohawk · · Score: 2, Informative

    And yet none of that explains why it is necessary for the original record to persist indefinitely.

    It isn't "indefinitely," it is until vacuum is run, and yes, queries run while vaccum is operating.

    Every database that has "multi-versioning" needs some sort of "purge" operation. It is all how and when it is executed.

  37. Re:Postgres by RzUpAnmsCwrds · · Score: 2, Insightful

    which is neither yours nor very good SQL

    Open-source GPL + optional commercial licensing not good enough for you?

    real database

    But maybe we don't need a "real" database. Maybe we need an easy-to-use replacement for flat files with some database features. Not everyone is running a bank, or handling a billion emails a day, or tracking inventory for Wal-Mart. Lots of users just want something that can handle their small little application.

    IMHO, one of the reasons why the web is broken is that it is so easy to create content that no one takes the time to learn the basic computer science involved

    Spoken like a true CS major. CS is a valuable, valuable field - I have nothing but the highest respect for it (which is why I'm getting an ECE degree + CS minor). But the web is not 'broken' - it is the single most valuable informational resource that we have ever created. And the web is useful precisely because you don't have to understand CS to create content. Do you think that there would be 1/1000th of the content on the web if you had to understand CS to contribute to it? No. What we would end up with would be a web that consists entirely of pages created by pencilnecks like yourself and by corporations with big budgets. There would be no Slashdot. There would be no Wikipedia.

    In MySQL, the second query would have to wait.
    Perhaps you should stop using MyISAM and start using InnoDB:
    http://dev.mysql.com/doc/refman/5.0/en/innodb-cons istent-read.html

  38. MySQL doesn't scale by orthogonal · · Score: 5, Insightful
    I recently did a little consulting project for a company with a MySQL database. I was left unimpressed.

    Basically, they needed to aggregate data from about 56 million rows in table, and required a self-join as well. I got the consulting contract because this was taking at least six days to complete.

    Inputting the 56 million records took about a hour; this included creating three indices.

    So far so good. At that point, to make in run faster, I wanted to pre-calculate and deformalize the data the self-join would give. I'd already included columns for this denormalized data in the table, so it was pretty much
    update datatable a set a.denormed = (select max( b.foo ) from datatable b where a.customer_id = b.customer_id)


    A simple correlated subquery self-join in a update. Low and behold, MySQL doesn't allow this,. at all:
    "Currently, you cannot update a table and select from the same table in a subquery." (MySQL official documentation, 13.2.10)


    Ok, so instead of a subquery we can do a join, but that means we have to throw away the max() operation. Without the max predicate we're doing 1-to-Many joins on b where there is more than one row matching our criteria, and so we're potentially doing multiple updates (all but one of which gets "thrown away") to a row.

    Ok, so far so good.

    First time around, I included the demoralized column in an index, and of course the update changed the column values. If I dropped and re-created the index, MySQL took about four hours to re-index (four times the time it took to make the index when it BCP'd it in). But if I repaired the index, rather than dropping it, well, it never actually completed, becasue after two days I killed it. What the hell?

    Finally, to display the data, I needed to do some date manipulation, a lot of it repeated. In pg, I'd have written the code once, in a user defined function. In MySQL, that requires compiling a shared library, so instead I repeated these rather long calculations in a select. Tedious and error prone. (In MySQL's favor, the built-in date functions are a lot cleaner than T-SQL's.)

    Eventually I got a six-day or longer process down to three hours, but it wasn't pretty.

    So long story short: a business goes with MySQL because it's "fast". At a certain point, it ceases to scale, and you have to perform "heroic measures", denormalizing and pre-calculating. The index repair is a mess. You can't easily encapsulate code in functions or, prior to 5.0, views. It's no longer fast, and your mission critical business requires calling a consultant to optimize what was perfectly good code before the table size grew.
  39. SQL sucks by Sloppy · · Score: 2, Insightful

    Sarcasm or not, I half agree with that.

    Today's problem isn't that databases are bad, it's that we use a textual language to interface with databases, and it blurs the line between data and code.

    SQL sucks.

    --
    As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
  40. Re:There ARE other scriping languages besides PHP by VGPowerlord · · Score: 2, Informative
    No, this myth comes from the PHP manual, which says
    PHP succeeds an older product, named PHP/FI. PHP/FI was created by Rasmus Lerdorf in 1995, initially as a simple set of Perl scripts for tracking accesses to his online resume.
    --
    GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  41. Slammed? I think not. by sherriw · · Score: 2, Insightful

    RTFA geez. The artitcle was not about postreSQL, it merely mentioned it. He didn't slam it at all or even state that you shouldn't use it. Simply said that if desired you may be able to avoid using it and emulate missing features of mySQL using php. He was illustrating the capabilities of php, not slamming postreSQL. By the way, many hosting providers provide mySQL but not postgreSQL so it may be useful to work around not having it.

    Where did the title for this slashdot post come from? The couple sentences that mentioned postreSQL? What about the rest of the article? Stop being drama-queens. Slashdot needs more serious posts- not this flame-inducing crap.

  42. Validating Input vs. Inexperienced Developers by billstewart · · Score: 3, Interesting
    "You don't know that you have to filter user input," Lerdorf exclaimed.
    Lerdorf advised PHP developers that nothing that comes across the wire is to be trusted.

    It shouldn't be necessary to say that, but unfortunately it is. When I took Computer Science 100 in college 30+ years ago, the first lesson about inputting data was that you have to validate it before using it, because it's guaranteed that your program *will* be given bad data sometimes, and will occasionally be given maliciously bad data, and part of the grading process on programs was to run them on the professor's data set, which was malicious, especially at testing off-by-one errors and other boundary conditions. But enough other people didn't get that as part of their education, either in school or learning it the hard way in practice - sigh.

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
  43. Favourite Comment by Bob+Uhl · · Score: 2, Insightful
    My favourite comment is this one:

    PHP makes "wrong things" easy, and "right things" hard.

    Evidence: "addslashes", "register_globals" and "magic quotes".

    More evidence: PHP Nuke, phpBB, PDO vs PEAR DB.

    Taking his advice on software is like taking a coprophagist's advice on fine dining.

    Couldn't be more correct. I've done a little PHP hacking when I'd no other choice--it's to be avoided when possible. For what it was meant for initially, it's not too shabby, but as a general solution it's...lacking.

    It's not really surprising that the author of PHP would think that the things PostgreSQL buys you aren't worth it. You know, little things like integrity, reliability and stability. Who needs those? Not anyone writing in PHP, certainly.

  44. Re:database usually more robust than apps that use by leifbk · · Score: 2, Funny

    Play around with ACID, and you're liable to take a header out the window !!

    Dude, that's another kind of ACID. It's database ACID (Atomicity, Consistency, Isolation, and Durability), not the stuff that people got high on in the sixties. Concerning the latter, there actually have been unsubstantiated rumors about people who imagined they could fly and took a dive through the window.

    --
    I used to be a sceptic. These days, I'm not so certain.
  45. Zend's ZActiveRecord Boondoggle by SimHacker · · Score: 4, Insightful

    The creators of PHP are morons, and their support company Zend is dishonest and incompetent. The ZActiveRecord boondoggle demonstrates exactly what I mean: They can't program their way out of a paper bag, an don't even understand the limitations of the very language that they haphazardly "designed".

    It makes me laugh that Lerdorf would slam Postgres, because the PHP designers have no understanding of object oriented programming or databases: instead they invent half baked cargo-cult designs, which are naive reactions to other systems they don't understand: they try to ape their surface features without understanding the reasons behind the way they're designed.

    PHP references were thrown in as a band-aid to work around the horrible design flaw that arrays and objects were foolishly DEEP COPIED by default. If you pass or return an array from function to function, its contents are DEEP COPIED, which is EXTREMELY inefficient and leads to all kinds of horrible bugs because it's the last thing a sane programmer would expect. So instead of fixing the design flaw in PHP, they add "references" that LOOK and SOUND like C++ references, but actually are completely different, again misleading programmers into thinking they understand what's going on, but working totally differently than a sane person would expect. PHP references are actually half baked symbol table references. The sloppy implementation caused many bugs that CORE DUMP PHP! PHP references were so poorly thought out and badly designed, that there were many edge conditions that they hadn't considered, that simply didn't work together, caused memory leaks and core dumps, and had useless and confusing semantics: callers passing references, functions declaring that they take references, functions returning references, etc. Compare that to C++'s simple and consistent definition of references in term of pointers. The only way to make a PHP reference to an object is to put it in a variable -- you can't make a reference to a field of an object or the return value of a function without storing it in a temporary variable -- totally unlike C++, and totally stupid.

    PHP's object oriented programming system is a half-baked imitation of C++'s object model, haphazardly designed by charlitans who had no clue about the fundamentals of object oriented programming, elegant language design or efficient implementation. First of all, if you're going to try to imitate an existing design without understanding it, then for god's sake, at least imitate a language whose object system doesn't suck, and a language that has similar semantics to the language you're trying to kludge. C++ is a static compiled language, and its object system deeply reflects that fact. (That is to say, there's very little reflection beyond RTTI, because the compiler throws all the interesting stuff away! And C++'s oop design had to make many horrible compromises because the C++ object system was designed to map directly into C semantics [since the original C++ compiler compiled C++ into C.]) Most of those C++ design decisions make absolutely no sense for a dynamic interpreted language like PHP. (Many of them made very little sense for C++ itself, but even less sense in the context off PHP.)

    One prime example of how PHP screwed up its object system, is that they blew it on static methods, in a way that makes it impossible to properly implement an ActiveRecord-like ORM (among other us

    --
    Take a look and feel free: http://www.PieMenu.com
  46. speed up your database layer by brennz · · Score: 2, Funny

    Switch out your Postgresql database for a Mysql database running on speedy ISAM tables.

    VROOOOOOOOOMMMMMMMMMMMMMMM!

    Is that the sound of your database speeding up, or your data integrity disappearing?

    Only Rasmus Lerdorf really knows...

  47. Not a great idea at all. by TheLink · · Score: 4, Insightful

    "magic quotes" was, is and will forever be a terrible idea.

    It is one of the many PHP misfeatures that make it easy for programmers to do the WRONG THING.

    The correct way to do things is to filter/quote inputs to your program accordingly so that your program can handle them correctly.

    Then you filter/quote outputs from your program to other programs accordingly so that those programs can handle the outputs correctly.

    If you don't do that you will end up with corrupted or misinterpreted data or worse.

    The correct filtering/quoting for an Oracle database is different from that for MySQL, and is different for a web browser, and for syslog.

    Magic quotes combines all the quoting with one "easy" "fix", and because of this sort of wrong-minded thinking, plenty of sites are littered with spurious backslashes in their content.

    There are plenty of other things PHP does wrong, and a lot of those are PHPisms - the things that make PHP PHP. By the time they fix those, PHP ends up not like PHP. Go look at the "backtracking" changes from PHP3 to PHP5.

    You might as well skip all that crap and go with some other programming language - like python, perl, ruby.

    BTW the same goes for MySQL, look at the changes from MySQL3 to MySQL5. MySQL3 = "Oh you don't really need transactions at all". MySQL4, "use transactions if you don't need speed". MySQL5 "oh yeah quietly corrupting data by default is a bad idea after all".

    With PHP/MySQL 3 to 5, if you leave the defaults on, lots of things break, because the old way of doing things was a bad idea e.g. register_globals=on.

    With Postgresql, the direction and principles have remained pretty much the same over the years- just getting better and better. So if you have written a program for postgresql 6.5, you can pretty much upgrade to 8.1 and your app will usually work by _default_ and work faster too.

    --
  48. Re:There ARE other scriping languages besides PHP by howardd21 · · Score: 2, Insightful

    You mean like when they supported Windows 98 up until July 11, 2006?

    --
    no comment
  49. Re:Postgres by vadim_t · · Score: 2, Informative

    It does, but that's really a different matter.

    Under MSSQL, there's no way of reading stuff from a table and not having the possibility of blocking something else or getting blocked. It's a trivial mistake to make, open the Enterprise Manager, load a big view or table and leave it open. The darn thing will keep a lock on the table unless you scroll down to the bottom of the result list.

    You can use the WITH(NOLOCK) hint, but that's crap, as now you get uncommitted data in your SELECT.