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

24 of 527 comments (clear)

  1. 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 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.
    5. Re:Avoid databases... by rk · · Score: 5, Funny

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

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

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

      You had stuff?

    9. Re:Avoid databases... by Anonymous Coward · · Score: 5, Funny

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

    10. 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
    11. Re:Avoid databases... by paranode · · Score: 5, Funny

      You it?

      Maybe this too far...

  2. 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
  3. 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.
  4. 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 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.

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

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

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

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

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