Slashdot Mirror


Pro MySQL

Rob Lanphier writes "I'm sure there are plenty of people like myself who do a fair amount of programming against MySQL databases, and consider it a feature of the product that it's pretty easy to do without having to fuss much with the actual database. Still, it's nice to look at what goes on under the hood, even if smoke isn't pouring out from beneath it. Pro MySQL by Michael Kruckenberg and Jay Pipes provides a broad well-organized exploration of intermediate and advanced MySQL topics that is a satisfying overview of the database management system." Read the rest of Rob's review. Pro MySQL author Michael Kruckenberg and Jay Pipes pages 734 publisher Apress rating 9 reviewer Rob Lanphier ISBN 1-59059-505-X summary MySQL overview for more advanced users

This book seems ideally suited for a couple of different audiences: Application developers with basic SQL knowledge hoping to gain a deeper understanding of the product and databases in general. The book provides a basic overview of the use of triggers, stored procedures, and cursors, among other things, before getting into the MySQL specifics. Experts in other database management systems (e.g. Oracle, Sybase) who want to apply their expertise to MySQL. The book provides a good tour of advanced MySQL functionality, and does a fair job of pointing out MySQL's shortcomings where they exist (which are much fewer in the 5.0 series). Such readers may be annoyed by the MySQL-centric views that surface from time-to-time, but all of the information should be there.

Pro MySQL is probably too advanced for someone just getting started with SQL databases in general. If you really haven't done much with SQL or relational databases at all, you should start elsewhere.

That said, there's a lot of information in here for beginners, and doesn't rush headlong into complicated discussions without at least a cursory explanation of the basics. For example, Chapter 2 has a nice review of many basic computer science concepts. Chapter 4 ("MySQL System Architecture") gives a light overview of the MySQL source code, highlighting a unique advantage of using open source. Though not the strongest chapter in the book, it includes an interesting section titled "A Typical Query Execution", which walks down the call stack explaining the source code for a typical SELECT statement. Readers might want to skip to this part of the chapter before reading the rest.

The real strengths of this book are in the chapters that deal with the database at a slightly higher level, which is most of the book. ACID compliance is covered in a thorough way, with many hands-on examples to ensure a solid understanding of the topic. The detailed discussion of the various storage engine types (focusing mostly on MyISAM and InnoDB, but touching on the others) is very useful in understanding MySQL's unique pluggable engine model, and how to leverage it. Chapters 9 through 13 provide great reference material for MySQL 5.0's advanced functionality, which includes information on stored procedures, functions, cursors, views and triggers. The final chapters (14 through 21) would stand alone as a separate book for administering a production MySQL database.

Chapter 8 ("SQL Scenarios") alone makes this book well worth the purchase price, providing recipes for solving some common problems with SQL. Some are rather simple, such as an optimization for using "OR" in "SELECT" statements in older versions of MySQL. Others are rather complicated and involved (but very useful), such as a nice way of storing hierarchical data in a table using the nested set model. The authors are careful to credit their source, Joe Celko's book Trees and Hierarchies in SQL for Smarties, for the latter. Hardcore SQL junkies may want to go straight to the source, but it's nice to see the material presented in a way that helps bring beginners up to an expert level.

The book's main shortcomings are in dealing with products that aren't downloaded off of mysql.com. MySQL's GUI tools get ample treatment (with copious screenshots, including a confirmation dialog) but the very popular phpMyAdmin tool is not mentioned anywhere. In discussing MySQL's lack of role-based access control, the authors write: "If you feel MySQL's normal user access and privilege verification system will not meet the needs of your organization, head over to [MySQL's MaxDB site] to check out how MaxDB implements its role-based system[...]", ignoring the elephant in the room, so to speak.

On a few occasions, the authors do veer into unsupported yet strongly worded assertions. For example, "This fact [that MyISAM is seemingly more efficient at storing data than InnoDB] should not be a factor in how you choose your storage engines..." (emphasis theirs). Without guidance on how much of a difference (10%? 500%? wildly unpredictable?) and a definition of the problem being solved, it's hard to say with such certainty whether or not this is a reasonable assertion. Also, "be conservative, especially when deciding on the length of character columns that will be frequently indexed", ignoring the tradeoffs that lead to the Y2K problem, for example. The advice given may be quite sound, but it's not presented in a way that convinces the reader that the authors have thought through all of the implications of their advice.

By and large, though, this is a very happy addition to my bookshelf. The organization is coherent and the chapters all have appropriate depth and have very useful information. I imagine I will refer back to this book often in building SQL applications, and I recommend it to anyone looking to boost their MySQL knowledge.

You can purchase Pro MySQL from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

100 comments

  1. Could we not talk about postgresql please? by Anonymous Coward · · Score: 0

    SSIA. TIA.

    1. Re:Could we not talk about postgresql please? by voice_of_all_reason · · Score: 4, Funny

      While I agree with your first point, it simply has to be reiterated thaWarning: mysql_connect(): Too many connections in /home/virtual/site1/fst/var/www/cgi-bin/secret.php on line 7 unable to connect to msql server: Too many connections

    2. Re:Could we not talk about postgresql please? by prockcore · · Score: 1
      While I agree with your first point, it simply has to be reiterated thaWarning: mysql_connect(): Too many connections in /home/virtual/site1/fst/var/www/cgi-bin/secret.php on line 7 unable to connect to msql server: Too many connections


      The default apache is installed with MaxClients at a pathetic 150.. it's obviously not suitable for serious web serving.

      Sheesh.. boost the number of connections on mysql.
    3. Re:Could we not talk about postgresql please? by Anonymous Coward · · Score: 0

      My balls use mysql

    4. Re:Could we not talk about postgresql please? by Anonymous Coward · · Score: 0
      While I agree with your first point, it simply has to be reiterated thaWarning: mysql_connect(): Too many connections in /home/virtual/site1/fst/var/www/cgi-bin/secret.php on line 7 unable to connect to msql server: Too many connections

      My balls use mysql

      I doubt they have a problem with too many connections.

    5. Re:Could we not talk about postgresql please? by BenjiTheGreat98 · · Score: 3, Funny

      The connections are probably limited to 127.0.0.1

      --
      :wq
    6. Re:Could we not talk about postgresql please? by voice_of_all_reason · · Score: 1

      My point was really in expressing the rampant idiocy of turning webpages into code. If even the smallest run-time error occurs and you don't catch it -- that's it, end of website! At least until you're made aware and can fix it.

  2. Getting the trolling out of the way by Anonymous Coward · · Score: 5, Funny

    Pros don't use MySQL hyuk hyuk!

    1. Re:Getting the trolling out of the way by Anonymous Coward · · Score: 0

      Oh yeah, baby! BRING IT ON!

    2. Re:Getting the trolling out of the way by Anonymous Coward · · Score: 1, Funny


      So tag the article "oxymoron" :)

    3. Re:Getting the trolling out of the way by GoodOmens · · Score: 1

      Lol I'm only using Oracle because of the Goverment.

      And its Oracle 8.1 .... yuck! Give me at least 10G ~.~

    4. Re:Getting the trolling out of the way by seek31337 · · Score: 1

      Yeah, no serious sites use MySQL. They *ALL* use Postgres. Right? Right? It's like saying Pro Linux. Hah!

      --
      No SIG for you!
    5. Re:Getting the trolling out of the way by Anonymous Coward · · Score: 0

      I thought this was an overblown myth until recently when I was using MySQL and discovered I couldn't even use the now() function as a default value for a datetime. I ran screaming back to PostgreSQL.

  3. Pro Advanced Hints by Anonymous Coward · · Score: 3, Interesting

    Is there fulltext indexing with innodb tables yet? Or should I not be using FT indexes because they bog down users with all that convenience and ease-of-use?

    1. Re:Pro Advanced Hints by rylin · · Score: 3, Insightful

      In production / general availability, it's not there.
      I believe it's in the 5.1 betas though.

      A lot of the talks at this year's UC related to the storage engine agnostic behavior (backups, FT).

    2. Re:Pro Advanced Hints by Anonymous Coward · · Score: 0

      You should be using a proper rdbms..

  4. Where there's fire... by __aaclcg7560 · · Score: 3, Funny

    Smoke usually comes out of a server when the CPU is on fire or out of the ears of someone paying Oracle fees. But I have never seen a smoking database.

    1. Re:Where there's fire... by solafide · · Score: 3, Funny

      It happens. It happens when some Luddites are hosting their own website, about 1 hit a day, and are smoking a cigarette. Then they get slashdotted and they're still using card catalog databases, so the Luddite has to get to work serving out of the database, the cig falls out of his mouth, and the database catches on fire. :)

    2. Re:Where there's fire... by Anonymous Coward · · Score: 0

      It happens more often when you're perusing a database of barbecue recipes. Tons of smoking databases there.

  5. Pro MySQL?? by sam0vi · · Score: 0

    I wonder how would big would the book if it were against. AIFOL

    --
    When my Karma level reaches 0 I feel in piece with the Universe
    1. Re:Pro MySQL?? by inotocracy · · Score: 1

      Your typing scares me. :|

  6. see also the canonical text on the subject by darkuncle · · Score: 4, Informative

    (aside from mysql.com/doc/ of course):
    Zawodny's "High Performance MySQL", from O'Reilly. Highly recommended for DBAs and sysadmins looking to design, build and operate MySQL clusters, do backups and replication, and generally squeeze the most performance they can out of MySQL (and to a lesser degree, out of LAMP in general).

    --
    illum oportet crescere me autem minui
    1. Re:see also the canonical text on the subject by OnyxRaven · · Score: 1

      I have to throw in my agreement - the High Performance MySQL book is a thing of greatness, which seems to cover all the bases for a professional using MySQL.

      One of the better things about the book is it does explain how the underlying engines store and retrieve data, which gives good insight into performance problems and how to tune databases and requests for proper and efficient execution.

      --
      --onyx--
    2. Re:see also the canonical text on the subject by Anonymous Coward · · Score: 0

      I agree that High Performance MySQL is a great read; however, it only covers 4.1 and earlier versions, and much of the information is quite dated at this point. Pro MySQL goes under the hood of MYSQL 5.0.

  7. Sloppy Editing by hamfactorial · · Score: 0
    Experts in other database management systems (e.g. Oracle, Sybase) who want to apply their expertise to MySQL.

    What about the experts? What did they do or say or think? Dear God, I must know! Save me Captain Editor!

    --
    Did you know subscribers can see articles in the future? Holy shit!
    1. Re:Sloppy Editing by Anonymous Coward · · Score: 0

      Editing? On Slashdot?

    2. Re:Sloppy Editing by Anonymous Coward · · Score: 0

      They looked at MySQL and started laughing hysterically.

  8. DBA, please. "unique pluggable"? by xxxJonBoyxxx · · Score: 4, Informative
    ...MySQL's unique pluggable engine model...
    I've been working with MySQL for something like seven years. Not once has it been important that MySQL's engine model is "unique" or "pluggable"; what is important is that it supports a couple of different database formats.
  9. SQL book recommendation? by Anonymous Coward · · Score: 1, Interesting

    If you are just starting out with SQL, what book(s) would those familiar with it recommend?

    1. Re:SQL book recommendation? by MilwaukeeCharlie · · Score: 3, Interesting
      If you are just starting out with SQL, what book(s) would those familiar with it recommend?

      If you mean MySQL, the topic at hand, I have nothing for you. However, if you meant exactly what you wrote, I picked up Sams Teach Yourself SQL in 10 Minutes from my local library last fall, and loved it. Learned a lot, quickly.

      --
      [[Jdapnc. O,..y (Nuts...keyboard stuck in Dvorak mode again.)
    2. Re:SQL book recommendation? by east+coast · · Score: 1

      You may want to look into one specific to your DBMS. I started writing SQL for Informix and used The Informix Handbook which covered a wide range of Informix topics related to many areas outside of SQL.

      Was it the best book for the time? Not really but the price was right and it helped introduce me to other DB concepts that would become more important the more I worked with Informix.

      --
      Dedicated Cthulhu Cultist since 4523 BC.
    3. Re:SQL book recommendation? by Ruie · · Score: 1
      If you are just starting out with SQL, what book(s) would those familiar with it recommend?

      O'Reilly pocket mysql. Or just read MYSQL docs.

    4. Re:SQL book recommendation? by Gulthek · · Score: 1

      You could do worse than 'Learning SQL' (which does all but a couple examples in mySQL). No need to get into mySQL specifics until you know how to use SQL itself.

    5. Re:SQL book recommendation? by legoburner · · Score: 1

      I'll give another vote for the mysql docs. I dont think I have ever had an issue with mysql that was not solved somewhere in their massive documentation archive. (ok ok until I started playing with C-JDBC ;))

    6. Re:SQL book recommendation? by Gospodin · · Score: 1

      I'm sure there are many fine ones, but I started with Understanding SQL. It's a bit old (1990), but there is a 2nd edition available (although only "used" on Amazon, which is why I didn't link to it). It's pretty DBMS-agnostic, covers the basic ground pretty well. I learned a lot without even having a DBMS to practice with (this was pre-MySQL).

      --
      ...following the principles of Heisenburger's Uncertain Cat...
    7. Re:SQL book recommendation? by NineNine · · Score: 1

      MySQL is a (low end) database product. SQL is a language. Somehow, I doubt that a book covering a certain product is appropriate for somebody wanting to learn a lanugage.

    8. Re:SQL book recommendation? by Anonymous Coward · · Score: 3, Informative

      Before learning any particular product, learn the basic theory that underlies all data management. Even just a small understanding of what a database is, how it links to facts in the real world, and what the underlying operations are will put you light years ahead of your peers.

      The best book I've found for that is "Database in Depth" by Chris Date. Very short, less than 300 pages. In fact the relational model is pretty simple, you could explain it succinctly in a page or two, but amazingly, so few people bother to learn it. Or they think that an SQL database represents the relational model (it doesn't). The relational model can be used to model SQL, hierarchical (XML) or network (object) databases, because it is a completely general model.

      Date's book has all the information you need, but it does seem a bit distant from today's "Web 2.0" type of programming. Don't let that faze you, just remember that the relational model works for any type system, including SQL's strings and integers, and object-oriented types like Customers and BlogPosts.

      Don't fall into the trap of only learning data management at the syntax-oriented, cookbook-level of understanding, based on today's limited products. Dig deeper.

    9. Re:SQL book recommendation? by flupps · · Score: 4, Informative

      Those are maybe not newbie books, but the books here all have some nuggets while learning databases (maybe not the initial start, but after a while if nothing else)

      An introduction to database systems - C.J. Date
      Covers the relational model, quite heavy on theory, but gives an excellent walkthrough of the fundamentals.

      SQL For Smarties - Joe Celko
      A good SQL Programming book, covers normalization and most features found in databases, anyone programming databases should read this one

      SQL 1999 Complete, REALLY - P. Gulutzan, T. Pelzer
      Good coverage of what's included in the 1999 SQL standard and some examples and discussions around this.

      Translucent Databases - P. Wayner
      Covers how to handle sensitive data in databases, letting users use data, but not be able to fetch or abuse it

      The two MySQL books I'd recommend are "High Performance MySQL" by J.Zawodny and D.Bailing and "MySQL" by Paul Dubois.
      Another good database book for performance tuning is "SQL Performance Tuning" by P.Gulutzan/T.Pelzer

      Hope this helps...
      cheers,

    10. Re:SQL book recommendation? by Ruie · · Score: 1
      MySQL is a (low end) database product. SQL is a language. Somehow, I doubt that a book covering a certain product is appropriate for somebody wanting to learn a lanugage.

      I actually misspelled, the book name is "pocket sql" or something like that, it describes sql syntax specific to sql server, oracle, db2 and mysql.

      As for "low end" this is very relative. I am crunching through .7 TB of data sitting in MySQL right now and it is quite efficient. In particular, if one were to construct a metric like database_ops/$$ then it is not exactly obvious which DB will come out on top - not needing to count the licenses one has make for much easier deployment on clusters.

      An free software product with well-understood design and performance and unrestricted scalability is often the only answer to a high-end problem.

    11. Re:SQL book recommendation? by jadavis · · Score: 2, Interesting

      I read and enjoyed both An Introduction to Database Systems and The Third Manifesto, both also by Date. Would you say that book would add something, or would it be redundant with his other writings?

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
  10. I never program against! by gandracu · · Score: 5, Funny

    Databases are my friends. I program for them, not against them...

    1. Re:I never program against! by TheSpoom · · Score: 3, Funny

      Unless you happen to be in Soviet Russia, in which case your database programs you.

      --
      It's better to vote for what you want and not get it than to vote for what you don't want and get it.
      - E. Debs
  11. Re:Impressive by grub · · Score: 0, Flamebait


    "Pro MySQL" is in the same vein as "Redhat Enterprise"

    --
    Trolling is a art,
  12. Re:DBA, please. "unique pluggable"? by flupps · · Score: 2, Informative

    And it's not pluggable until 5.1, prior to then it still has to be compiled in.

  13. Re:Impressive by Chysn · · Score: 5, Funny

    I've had it with these motherfuckin' trolls on this motherfuckin' MySQL thread!

    --
    --I'm so big, my sig has its own sig.
    -- See?
  14. shocked by kailoran · · Score: 1

    Is something wrong with Slashdot? A review that is *not* a glorified table of contents???

  15. Me, Myself & I by d3xt3r · · Score: 2, Informative

    I see too many people, including the submitter, use myself where me or I should be used. Hey, you don't sound more professional when you use myself in places it doesn't belong, you actually sound like a moron.

    Here are some resources for anyone still confused about this.

    </RANT>
    1. Re:Me, Myself & I by Anonymous Coward · · Score: 0

      Looks like someone has a case of the Mondays! :(

    2. Re:Me, Myself & I by lowenstein · · Score: 0

      Keep the lang unregulated and free of expression, if someone thinks to use "myself" instead of "me" then let him do that, I can tell you, in Germany we suffer hard by those lang regulations, there are many cases when you and your common sense would use something else then what those regulators wants you to use, if you make mistake then you are doomed, english is good for not being a strictly regulated language, so keep it that way please.

    3. Re:Me, Myself & I by Anonymous Coward · · Score: 0

      You must be a blast at parties.

    4. Re:Me, Myself & I by zelator29 · · Score: 1

      I, myself, could hardly care less.

    5. Re:Me, Myself & I by g1zmo · · Score: 1

      Allow myself to introduce......myself.

      --
      I have found there are just two ways to go.
      It all comes down to livin' fast or dyin' slow.
      -REK, Jr.
    6. Re:Me, Myself & I by flight_master · · Score: 1

      I believe you mean "allow me to introduce myself". Sorry, couldn't resist.

      --
      "Free software" is a matter of liberty, not price.
    7. Re:Me, Myself & I by Anonymous Coward · · Score: 0

      Finally, we come to my number two man. His name? Number Two.

  16. Re:DBA, please. "unique pluggable"? by aboyko · · Score: 1, Offtopic

    Help me out here, because I've only really worked with PostgreSQL for the last seven years. Why is it important to support multiple database engine types, rather than settling on one good one? I'm given to believe that the general choices are between "ACID/correct/stable" and "WIKKED AWESUM FASSSST", but why this is a choice a DBA should have to make (per table? per database?) is unclear to this PostgreSQL user. Is there more to it? What keeps people from embracing the One Good One at this point?

  17. Are you astroturf? by Soong · · Score: 1

    Are you astroturf? Really, such content-free cheerleading is suspicious to me.

    To counter you, I have to plug my favorite alternative PostgreSQL.

    --
    Start Running Better Polls
  18. The heart of the DB by lowenstein · · Score: 0

    Grab those from MySQL "bdb\btree\*.*" and you've got pretty much the core of the speed and reliability of the fast indexed database of whatever.

  19. Spelling? by Chief+Typist · · Score: 4, Funny

    Shouldn't "Pro MySQL" be spelled as "PostgreSQL"? :-)

    -ch

    1. Re:Spelling? by astellar · · Score: 0

      MySQL lacks very important PostgreSQL feature - COALESCE hell ;)

    2. Re:Spelling? by Anonymous Coward · · Score: 0

      That joke is getting really fucking old... how about coming up with something new instead

    3. Re:Spelling? by bokutoe · · Score: 0

      new to me.

  20. Blobs by Anonymous Coward · · Score: 0

    Here's a question. I'm thinking of setting up a DAM using Dspace, and aside from the load Java will place on the server. How well do databases like MySQL or Postgresql handle BLOBS? Especially from a performance standpoint?

  21. Great book by rylin · · Score: 2, Interesting

    While at this year's MySQL Users' Conference, I managed to pick this book up at the quiz show.
    Rather than what the blurb said regarding audiences, I'd say it's geared towards developers and dbas or system administrators - not people migrating from another db vendor.

    It does show some common pitfalls; some unique to mysql, some to sql in general.
    I definitely liked the in-depth chapters regarding the way the core engine and various storage engines work, and all in all I'd have to say it's probably the best book about mysql I've read.

    A few glaring omissions are in it, but I'm sure there'll be a new revision in a few months' time.

  22. Shit Happens by Reverend528 · · Score: 2, Funny

    WIFE: "Honey you stepped in dog poop again. "
    ME: "Trolls on a Thread..."
    DOCTOR: "Your cholesterol is 290. Perhaps you want to mix in a walk once in a while."
    ME: "Trolls on a Thread..."
    WIFE: "Honey while you were on your cholesterol walk you stepped in dog poop again."
    ME: "Trolls on a Thread..."

  23. Re:DBA, please. "unique pluggable"? by flupps · · Score: 5, Informative

    Different workloads will have way different characteristics.

    What you can tweak on locking level (table-level, page-level, row-level, MVCC, etc) in table/schema settings in other database products you pick by chosing engines in MySQL.

    You can see it in a way as setting groups of settings that will be a good fit for the workload of your environment.

    Jack-of-all-trades, master-of-none concept, I guess.

    MyISAM - Data warehousing/DSS/Read only archives optimized for bulk operations (big scans, flexible index formats, small disk footprint for data/index) but will not do well in a typical OLTP application because of table-level locking, bad crash durability and lack of ACID in general.

    InnoDB - Typical traditional OLTP, row level locking, MVCC, Clustered PK w/ using B+tree with savepoints within transactions and other features for typical OLTP applications

    Memory - No disk footprint, extremely fast - for summary tables, simulations, temporary operations (, session handling?).

    NDB - Typical telcom, small rows, quite a few of them and high concurrency/throughput with automatic failover in the case of node failure. Slow for big scans and joins, but great for key lookups on single tables, but with transaction volumes and throughput you can't reach with the others for this niche usage.

    Falcon - Jim Starkey's new engine with some cool new things (see this link for a presentation)

    Arhive - On-insert compression of rows for dump-archive-forget style data.

    You can achieve lots of those things with normal settings, but to optimize on a storage level for cecertain operations can give you quite a boost for some things.

    There are some cool aspects to this when it comes to proprietary formats, though. You can create engines for reading log files so you can access log data with SQL commands (there are engines for reading CSV files, apache log files, etc - think I even saw someone working on reading MS Access .mdb files at some point).

    Sure, it would be cool to have this one perfect storage system doing everything, but I guess you can use file systems in operating systems as an example, why doesn't all operating systems only use EXT3, Reiser, UFS, XFS, JFS, NTFS, etc? There are pros and cons to everything, just pick whatever fits your need, just like you would pick the programming language and database that would fit your application project the best.

    If your database happens to be MySQL, you can go another step to pick the engine that will perform better or have the functionality you're looking for (or scalability or whatever you want).

    Maybe not an acceptable reason for you, but I hope you at least understand the concept better...
     
      cheers,

  24. Save yourself some money by buying the book here! by Anonymous Coward · · Score: 0

    Save yourself some money by buying the book here: Pro MySQL. And if you use the "secret" A9.com discount, you can save an extra 1.57%!

  25. ANSI SQL conformance? by dook43 · · Score: 1

    I've just programmed an extensible .Net data layer that supports MySQL, OLE DB (access) and SQL server. I can switch between databases with an entry in the app.config file. I have a couple of questions: MySQL uses the ` character to delimit fields, and SQL/Access use [ and ]. There is also the "LIMIT" clause vs the "Select TOP N" for Access/SQL. Which provider is correct? Are there standards for either of these?

    --
    This comment was randomly generated by a school of piranhas chewing on the PCB of a Microsoft Natural Keyboard.
    1. Re:ANSI SQL conformance? by flupps · · Score: 1

      MySQL uses the ` delimiter, but supports the correct (ANSI) " delimiter in ANSI mode or if you run with the ANSI_QUOTES option.

      Neither LIMIT nor TOP N is correct from a standard point of view.
      SELECT c1 FROM t1 ORDER BY c1 LIMIT 10 | SELECT TOP 10 c1 FROM t1 ORDER BY c1 should according to the standard be written as:

      SELECT c1 FROM (
          SELECT
              ROW_NUMBER() OVER (ORDER BY c1 ASC) AS rownumber, c1
          FROM t1
      ) AS tmp
      WHERE rownumber = 10

    2. Re:ANSI SQL conformance? by EsJay · · Score: 1

      In MS SQL, the command SET QUOTED_IDENTIFIER ON (or SET QUOTED_IDENTIFIER OFF) toggles the treatment of quotes.

      From MS SQL Books Online:
      "[SET QUOTED_IDENTIFIER ON] causes Microsoft SQL Server to follow the SQL-92 rules regarding quotation mark delimiting identifiers and literal strings. Identifiers delimited by double quotation marks can be either Transact-SQL reserved keywords or can contain characters not usually allowed by the Transact-SQL syntax rules for identifiers."

    3. Re:ANSI SQL conformance? by Anonymous Coward · · Score: 0

      I thought LIMIT 10 was standard. ROW_NUMBER() sounds like a Microsoftism to me.

    4. Re:ANSI SQL conformance? by lkcl · · Score: 1

      it's ansi 200N sql.
      postgresql doesn't support it yet, on the basis that if it doesn't
      even have a year, they ain't gonna add it :)

  26. MySQL 5 by larry+bagina · · Score: 4, Interesting

    Some of the "advanced" features of MySQL 5 make it more palatable to me. (I have a hard time triggers or views advanced when SQLite and every other SQL db supports them.)

    A lot of open source development web apps are targetted towards the lowest common denominator -- shared hosts that still use MySQL 4 -- so the adoption has been kind of slow. I have a couple GPL webapps which don't support MySQL due to the lack of triggers and views. Sure, you can fake it on the client side, but then again, you can fake an orgasm. I'd rather do it the proper way.

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

    1. Re:MySQL 5 by astellar · · Score: 0

      Unfortunately all the MySQL 5.0 advances makes it slower than MySQL 4. Lots of hi-load webapps don't need to use triggers, but very speed sensitive. Seems like 4.1 can save up to 10% time against MySQL 5. Websites typically performs lots of simple queries so this is a big point for me to keep MySQL4 on my shared hosting servers. If you need a triggers - go ahead, buy a dedicated server and install MySQL5.

    2. Re:MySQL 5 by larry+bagina · · Score: 1

      That's interesting. Nobody needs triggers or views, they're just syntactic sugar which makes development faster (and more consistent). I've often wondered if the MySQL speed advantage vs postgresql, et alia holds up if you can do 1 postgres query (and let the trigger update related tables to maintain referential integrity) or multiple mysql queries (doing it all manually).

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

  27. This book was actually a great help for us. by Anonymous Coward · · Score: 4, Insightful

    We recently had to implement a custom CRM system, and as would be expected we needed the services of an SQL database. One of our project leads actually had this book on his bookshelf, and the rest of us on the team took a chance to look over it during the process of selecting which database we'd use.

    What was best about this book is that it did cover fairly advanced topics. And that was helpful, as we could clearly see what features MySQL did not offer. Unfortunately for MySQL, it did not offer all of the features we wanted, and thus we instead went with PostgreSQL.

    1. Re:This book was actually a great help for us. by Dan+Ost · · Score: 1

      Did you run into any gotchas with PostgreSQL or is it really as full featured and
      easy to use as people claim?

      --

      *sigh* back to work...
  28. Friend don't let friends use MySQL by mlwmohawk · · Score: 4, Insightful

    I'm so tired of hearing about MySQL. Every last improvement they make for it, is completely pointess as more advanced, and free, databases are so far ahead.

    If all you want to do is "select * from mytable where col='foo'" you are wasting your time.

    My bigest beef with MySQL isn't its limitations, but the people who learn these limitations and never realize a relational database and query language is SO POWERFUL.

    So, they get an order of magnitude more data than needed from MySQL, process it in some scripting language, take the reduced data set, make another query to get what they wanted. In a *real* database, you'ld just construct the query correctly.

    Every time I see a MySQL cconnection error on a web site, and you see them every day, I just think the designer is a moron.

    1. Re:Friend don't let friends use MySQL by astellar · · Score: 0

      Do you prefer Oracle or DB2 for your guestbook or forum? ;)

    2. Re:Friend don't let friends use MySQL by mlwmohawk · · Score: 3, Insightful
      Do you prefer Oracle or DB2 for your guestbook or forum? ;)

      What is the point of using MySQL? If cost is an issue, PostgreSQL is free. IMHO PostgreSQL is, by far, easier to use than is MySQL. PostgreSQL scales better and by providing extensive SQL support, allows for more efficient and faster queries than MySQL ever could.

      If you need a banking quality database, then use Oracle or D2

      If you have two or more servers, use PostgreSQL

      If you have one server, use SQLite or PostgreSQL

      MySQL is just a mediocre database generally and poor example of a SQL database specifically. The Free Software movement is about building the best software. MySQL is not even close.

    3. Re:Friend don't let friends use MySQL by Not+The+Real+Me · · Score: 1

      "Do you prefer Oracle or DB2 for your guestbook or forum? ;)"

      That sounds like a job for an XML file that you append entries onto.

    4. Re:Friend don't let friends use MySQL by Anonymous Coward · · Score: 0
      I'm so tired of hearing about MySQL. Every last improvement they make for it, is completely pointess as more advanced, and free, databases are so far ahead.
      You are absolutely correct. The ONLY remotely valid reason for using MySQL over the superior alternatives like PostgreSQL is if you simply are given no choice, such as if your application will be hosted on an environment you don't control that only offers MySQL.

      I have never met anybody worth their salt who would choose MySQL over other free databases like PostgreSQL, if they are presented with the options and do even a short evaluation. You would indeed have to be a moron to choose MySQL.
    5. Re:Friend don't let friends use MySQL by mlwmohawk · · Score: 1

      That sounds like a job for an XML file that you append entries onto.

      That one quote typifies, IMHO, the problem with the web and why MySQL is so popular. A database, specifically a SQL database, is not only about storing data. It is about accessing and analying data.

      Many things, like concurrency for one, are handled at the database level that are not handled uniformly or particularly well at the OS level.

      A database is a wise choice for even the smallest guest book. When the database is free, why choose a toy (MySQL) when others are available for free (PostreSQL for one, but there are others.) Using and knowing how to use a real database provides so much benefit to even the most casual web site.

  29. Re:DBA, please. "unique pluggable"? by miniver · · Score: 5, Interesting

    I understand why MySQL supports so many different table engines. What I don't understand is why MySQL supports (or doesn't support) different SQL features for each engine. Why should I (as an application developer) need to know whether a table was built using MyISAM or InnoDB when I write MySQL queries? Oracle has a number of different ways to optimize tables and indexes, but all of those optimizations are transparent to the application code and queries (but not to overall application performancen at runtime). I've done application development on a dozen different relational databases over the last 20 years, and MySQL is the only database engine (since DBase, and DBase wasn't really an RDBMS) where the database didn't abstract these differences away from the developer.

    To use your filesystem metaphor, all of the filesystem implementations use the same VFS API -- I don't have to recode my application because I'm using ReiserFS today, when I wrote it using ext3.

    --
    We call it art because we have names for the things we understand.
  30. Re:DBA, please. "unique pluggable"? by flupps · · Score: 1

    Most of them are special purpose, and if you use them you design your whole application around the specific workings.

    The more general purpose ones (InnoDB, MyISAM, BDB, NDB, Falcon) are quite transparent.
    MyISAM of course doesn't fill ACID, so that would be something you definitely would want to know about, but otherwise it you should be able to switch without a single line of application code needing to change.
    (only things I can think about with syntax differences is if you use the GIS extension or fulltext extension to the SQL syntax with MyISAM - you can't currently do that on the others).

  31. Re:DBA, please. "unique pluggable"? by miniver · · Score: 1

    I was thinking about sub-queries, which the last time I checked, a significant part of the SQL standard, but not supported by some of the 'general purpose' table types.

    --
    We call it art because we have names for the things we understand.
  32. Re:DBA, please. "unique pluggable"? by flupps · · Score: 2, Informative

    Subqueries are handled on a layer way above of the actual storage layer, so all engines can handle this.

  33. Or.. by oSand · · Score: 1

    ef eye are ee bee eye are dee. A very good database that doesn't give the impression it has been scotch taped together by monkeys. Nice permissive licence, feature rich, reliable. firebirdsql.org

  34. Mr. Pipes by RalphTheWonderLlama · · Score: 1

    Is that guy's name really Pipes? It's like a bad pron name only this is a bad programmer name.

    --
    simple, fast homepage with your links: http://www.ngumbi.com/
    1. Re:Mr. Pipes by Somatic · · Score: 1

      I actually just loled. Mod parent funny.

      --
      My script don't crash! She crashes, you crashed her!
    2. Re:Mr. Pipes by Jay+Pipes · · Score: 1

      Yes, unfortunately, my name really is Jay Pipes :) I suppose me being a programmer is better than me going into the plumbing business, which unfortunately my father was in for 30 years. No joke.

      --
      Jay Pipes Community Relations Manager, North America MySQL, Inc. -- jay at mysql dot com
  35. Re:DBA, please. "unique pluggable"? by jadavis · · Score: 3, Interesting

    For each "feature" of the database, the MySQL advertisers (or advocates) use a different storage engine. For example, if you want the feature "easy to use, right out of the box" you get MyISAM, which means no ACID. If you want ACID, you use InnoDB. Full-text search and you're back to MyISAM. Cluster, you need a memory database that won't survive a power failure. If you like all the apps currently written for MySQL, you can't use strict mode and you're stuck with the least compatible dialect of SQL anywhere. If you want SQL compatibility, turn on strict and you can't use those other applications. In order to tell if MySQL actually meets the needs of your application (today), you have to build a huge matrix of compatibility. I hope you don't need ACID compliance and full text indexes at once! So much for easy to use...

    I think of MySQL as tradeoff-DB. Usually it's bad tradeoffs that you don't have to make in any other database.

    In my opinion, it's a great marketing ploy. People pay attention to claims, not caveats. Shout loud that you have a feature X, Y, and Z. That will work, even if the small print says you can't use X and Y simultaneously, and Z has some huge drawback. Nobody can ever "win" an argument against MySQL because the person you're arguing with can always claim features X, and downplay the importance of Y. Then, when you point out the importance of Y, someone else claims that it supports Y, and downplays X. And then they claim Z is just an extra feature for special use, and there's no really logical way to argue against including an option. MySQL is horribly misleading in its advertising.

    --
    Social scientists are inspired by theories; scientists are humbled by facts.
  36. Re:DBA, please. "unique pluggable"? by jan.blaha · · Score: 1
    Memory - No disk footprint, extremely fast - for summary tables, simulations, temporary operations (, session handling?).
    Actually, there's an example of another bad tradeoff: memory tables use fixed record length. They have no support for text type columns. Imaginary session data would have to be handled with CHAR column.
  37. Re:DBA, please. "unique pluggable"? by YeeHaW_Jelte · · Score: 1

    I think you're missing the mark here. Subqueries in MySQL are not dependant of the engine but of the version. MySQL3 doesn't support them, MySQL4 does, regardless of the engine.

    --

    ---
    "The chances of a demonic possession spreading are remote -- relax."
  38. don't use mysql for professional projects! by lkcl · · Score: 4, Insightful

    specifically, don't use it for 'comprehensive' projects, involving many programming teams and/or a hundred tables.
    don't even consider using MySQL 5 for at least another four years, for such projects, until it matures - and by that time, PostgreSQL, an already mature product that has had Views, Triggers etc. right from the start, will have had even more rigorous testing.

    see http://advogato.org/article/894.html for details.

  39. Re:DBA, please. "unique pluggable"? by Anonymous Coward · · Score: 0

    Yes, 4.x supports subs. And 5.x does too, and probably faster. But mysql subs still suck unbelievably on databases of any real size. I don't see that changing in the near future, and I'm still worried about the engine ownership issues and the Bermuda Triangle license. I'll stick with PostgreSQL, thank you.

  40. A GUI? really... by lonesome+phreak · · Score: 1

    people like myself who do a fair amount of programming against MySQL databases, and consider it a feature of the product that it's pretty easy to do without having to fuss much with the actual database. Still, it's nice to look at what goes on under the hood, even if smoke isn't pouring out from beneath it.

    Yeah, I heard there was some fancy-GUI interface to it...personally I like doing it all by hand, at least after the initial layout is set. I've been doing that since around 2002 though, so I'm pretty used to coming up with sql statements in my sleep at this point.

    --
    Maybe we DID take the blue pill. You wouldn't remember anyway.