

Transaction isolation is generally configurable in a variety of modes. Isolation keeps transactions separated from each other until they're finished.

A properly configured database wouldn't let you delete the customer record, if that meant leaving its invoices, and other associated records stranded.ģ. For instance, when you delete a customer record, you should also delete all of that customer's records from associated tables (such as invoices and line items). If one part of the transaction fails, all of the pending changes are rolled back, leaving the database as it was before you initiated the transaction. Consistency guarantees that a transaction never leaves your database in a half-finished state.

This is important in situations like bank transactions where transferring money between accounts could result in disaster if the server were to go down after a DELETE statement but before the corresponding INSERT statement.Ģ. With atomicity, these statements are treated as a single unit, and thanks to consistency (the C in ACID) there are only two possible outcomes: either they all change the database or none of them do. Suppose you define a transaction that contains an UPDATE, an INSERT, and a DELETE statement. A transaction can combine one or more database operations, for example:ġ. These features are scoped to a transaction, which is a unit of work that the programmer can define. ACID is an acronym that describes four properties of a robust database system: atomicity, consistency, isolation, and durability. The ACID TestĪ good way to differentiate databases and test overall quality is to perform an ACID test. If you're developing an application that has highly complex business rules, PostgreSQL lets you handle business logic on the database server. PostgreSQL also offers object-relational capabilities and geometric data types. These include more SQL functions, server-side procedural languages, and sophisticated methods for date manipulation. PostgreSQL, on the other hand, provides more features than MySQL. Developers of simple applications can live without the remaining features, such as stored procedures and subqueries, or can work around them with creative client-side programming. MySQL's claim to fame is that it provides a reasonable set of features, such as built-in SQL functions, that follow the 80/20 rule: It has the 20 percent of SQL capabilities that are needed for 80 percent of database applications. On both counts, the two packages are the closest they've ever been, so when deciding which to use in a Web application, a developer doesn't always have a clear winner. But times have changed and each database has progressed. Based on the track records of older versions, there's a lot of debate over the speed of PostgreSQL and the durability of MySQL. To many people, PostgreSQL and MySQL seem like similar, alternative databases. CD Home < Web Techniques < 2001 < September
