WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Which Storage Engine (table handler) to use with MySQL?
Categories : Databases, MySQL
Boaz Yahav
Date : Dec 22nd 2002
Grade : 1 of 5 (graded 1 times)
Viewed : 5012
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Boaz Yahav
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

MySQL 4.0 Standard comes with 3 main Storage Engines, MyISAM, HEAP, and INNODB. We
are often asked, which of them is the best choice for particular application. The
answer is that mixing storage engines would give best results in most cases.

Each storage engine has it's strong and weak sides.

MyISAM tables are really fast for select-heavy loads, while table level locks limit
their scalability for write intensive multi-user environments. MyISAM tables have
the smallest disk space consumption as well as such advanced features as full text
index, merged and compressed tables.

INNODB tables allow you to use ACID transactions, have row level locking and
consistent reads, which allow to reach excellent read write concurrency. InnoDB
tables also have primary key clustering, which gives excellent performance in some
cases. For referential constraints InnoDB tables offer foreign key support. Another
good feature of InnoDB tables, which helps a lot in case the operating system has
inefficient cache implementation, is that both index and data pages can be cached by
MySQL. All updates have to pass through transactional engine in InnoDB, which often
decreases performance compared to non-transactional storage engines. The outstanding
feature of InnoDB tables is also automatic crash recovery - in case MySQL shutdown
was unclean InnoDB tables will still recover to the consistent state, you will not
have to check or repair them. For 24/7 type applications InnoDB tables could be
chosen for HotBackup solution available - consistent backup can be taken without
affecting application any way.

HEAP is lightning fast in memory storage engine. It is designed for maximum speed,
however it has some limitations. The most important one is - data is lost at MySQL
shutdown. Heap also uses hash indexes, which do not allow to use indexes for range
queries and Heap doesnt support varchar, blob and text columns. Heap has locks at
table level, i.e. similarly as in MyISAM.

Table level locks are often blamed for being inefficient, however this is not that
simple. The smaller granularity of locks you have, the larger amount of locks you
have to set and check, which takes time, on other hand this leads to less false
conflicts - operations which could be executed in parallel are found as conflicting,
and one of them has to wait. This is one of the reasons why choice of storage
engines in MySQL offers excellent performance.

How do you usually mix storage engines? The most obvious way possible - you know the
operations, which are performed on the table and you select appropriate table type
for it.

MyISAM tables are really good for large constant tables or logging tables
(concurrent insert feature allows MyISAM tables to perform inserts even while table
is being read). They are also often good choice for tables with relatively
infrequent updates or fast selects - these will not lock the table for the long time
and so will not reduce performance.

InnoDB tables are good for intensively updated tables, which can have many long
selects running at the same time. They are also good choice for storing sensitive
information, such as user registration information or financial data, and of course
you should use these tables if you need ACID transactions. In case you have really
large table with many indexes it could be worth to have it in InnoDB type - you will
not have to recover the table in case of unclean shutdown, which could take hours.

Heap tables are best to be used for relatively small temporary tables, which are
small enough to fit in memory. Also you might wish to use temporary tables for
summary and cache tables, which you can easily and quickly regenerate.

In typical web application MyISAM table could be used for logging and search, InnoDB
tables for registration information and banner system, while Heap table for
temporary tables and pre generated news headlines and other data for high load pages.

Enjoy choice of storage engines for the best performance of your application with
MySQL!

Source : http://www.mysql.com/newsletter/2002-12/a0000000091.html



bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server.
Categories : Databases, MySQL, Complete Programs, PHP, Databases
How to thread a list of messages in database and show it in a treelike structure
Categories : PHP, MySQL, Databases
Simple conversion functions to change MySQL dates to arrays, arrays to MySQL dates.
Categories : PHP, Arrays, Date Time, Databases, MySQL
Checks Date-Input from HTML-Forms and converts to YYYY-MM-DD Format for MySQL Date-Fields
Categories : MySQL, Date Time, PHP, Databases
Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
Paginator - a class that can help you to split MySQL database query result sets to pages.
Categories : MySQL, Databases, HTML, PHP
Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0
Categories : PHP, Sessions, Databases, MySQL
Complex paging with no resultset limit
Categories : PHP, MySQL, Databases, Output Control, HTML and PHP
php-gtk mysql querying tool
Categories : PHP-GTK, MySQL, PHP, Databases
mediaCat-GTK v2.0.0 - an mp3/cd/dvd cataloging utility written in php-gtk which interfaces with mysql and ms access (or db supported by PHP's Unified ODBC Functions)
Categories : PHP, MySQL, MS Access, Utilities, Databases
Zip code range and distance calculation class v1.0.0
Categories : PHP, Databases, MySQL, Zip Code
Phorum, MySQL, Language, UK date format, MySQL UK Date format
Categories : PHP, Date Time, Strings, MySQL, Databases
MySQL Connection/Query Class
Categories : Databases, MySQL, PHP, PHP Classes
phpFormGenerator for Dynamic Form Generation from MySQL
Categories : PHP, PHP Classes, MySQL, Databases, HTML and PHP
 Eric Benoit wrote :889
Thanks Yahav,

That was very informative, it got me wondering if I have the best setup of table types and according to this article the answer would have to be NO! What I am wondering now is, can I change the table types of my existing, already populated tables? Or would I have to recreate and repopulate the tables with the new type. Thanks again, this was excellent!