Home > Enterprise Linux Tips > Administrator > MySQL database features: ACID, buffer pools and blob fields
Enterprise Linux Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ADMINISTRATOR

MySQL database features: ACID, buffer pools and blob fields


MiMi Yeh, Associate Editor
04.20.2007
Rating: --- (out of 5)


Enterprise IT tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


MySQL is a powerful, open source relational database management system. However, users may not be familiar with the full extent of all of its capabilities. In this tip, SearchEnterpriseLinux.com's MySQL core-certified expert, Scott Noyes, defines ACID-compliant transactions, blob fields and buffer pools and the functions of mulitple storage engines in MySQL.

More on MySQL:
Ask Scott a question of your own

Database learning guide

What are ACID-compliant transactions? Does MySQL support them?

Scott Noyes: ACID stands for Atomicity, Consistency, Isolation and Durability. In a database server with many simultaneous connections, problems might arise if some process changes data between the time an application has searched for it and tries to act on it. ACID-compliant transactions ensure that processes cannot interfere with each other, and that data remains in a complete state.

MySQL offers ACID-compliant transactions with the InnoDB engine, and the upcoming Falcon engine. See http://dev.mysql.com/books/mysqlpress/mysql-tutorial/ch10.html.

Can you explain how buffer pools relate to MySQL and databases, in general?

Noyes: Buffer pools are memory data caches. Reading data off a disk is slow, but reading data from memory is much faster. The first query to request a row of data must wait for the response from the disk. After that, the data is stored in the buffer pool, and other queries requesting that same row get a faster response.

Obviously, the cache can only hold a certain amount of data, so decisions must be made as to how much memory to allocate to the buffer pool, which rows to keep in the buffer pool and how to keep the cache and the disk in sync when the data changes. Read about InnoDB's use of buffer pools and how to configure for optimal performance at http://dev.mysql.com/doc/refman/5.0/en/innodb-disk-io.html and http://dev.mysql.com/doc/refman/5.0/en/innodb-tuning.html.

What is the equivalent of a blob field in MySQL?

Noyes: MySQL offers four blob types, which differ only in maximum size. They are tinyblob (256 bytes), blob (64 kilobytes), mediumblob (16 megabytes) and longblob (4 gigabytes). There are also the binary and varbinary data types, which are the same as char ard varchar, but store binary strings. See http://dev.mysql.com/doc/refman/5.0/en/blob.html and http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html for more details.

How do you combine two fields to create a third? For example, field1: abcd and field2: 1111need to be combined to get field3: abcd111.

Noyes: Use:

UPDATE table SET field3 = CONCAT(field1, field2)

Check out this list of string functions. This concatenation can be done automatically by adding BEFORE triggers on INSERT and UPDATE.

Within the trigger, set

NEW.field3 = CONCAT(NEW.field1, NEW.field2)

You can find out more about triggers in MySQL at: http://dev.mysql.com/doc/refman/5.0/en/triggers.html.

How do multiple storage engines work in MySQL?

Noyes: The multiple storage engine architecture allows applications to take advantage of the particular strengths of each engine, allowing for much finer grain control. Within a single database, you might have some tables using MyISAM for its speed, small memory footprint and fulltext capabilities, while others use InnoDB for its support of transactions and foreign keys. You can even roll your own storage engine, if you want to use MySQL as a front end to your proprietary data format.

Rate this Tip
To rate tips, you must be a member of SearchEnterpriseLinux.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts