【正文】
ovided a foundation upon which the Miracle of MySQL could be built.Some time in the 1990s, TcX customers began to push for an SQL interface to their data. Several possibilities were considered. One was to load it into a mercial was not satisfied with the speed. He tried borrowing mSQL code for the SQL part and integrating it with his lowlevel storage engine. That did not work well,either. Then came the classic move of a talented,driven programmer: “I’ve had enough of those tools that somebody else wrote that don’t work! I’m writing my own!”Thus in May of 1996 MySQL version was released to a limited group, followed by a public release in October 1996 of version . The initial public release provided only a binary distribution for Solaris. A month later, the source and the Linux binary were released.In the next two years, MySQL was ported to a number of other operating systems as the feature set gradually increased. MySQL was originally released under a special license that allowed mercial use to those who were not redistributing it with their software. Special licenses were available for sale to those who wanted to bundle it with their product. Additionally, mercial support was also being sold. This provided TcX with some revenue to justify the further development of MySQL,although the purpose of its original creation had already been fulfilled.During this period MySQL progressed to version . It supported a decent subset of the SQL language, had an optimizer a lot more sophisticated than one would expect could possibly be written by one person, was extremely fast, and was very APIs were contributed, so one could write a client in pretty much any existing programming language. However, it still lacked support for transactions,subqueries, foreign keys, stored procedures, and views. The locking happened only at a table level, which in some cases could slow it down to a grinding halt. Some programmers unable to get around its limitations still considered it a toy, while others were more than happy to dump their Oracle or SQL Server in favor of MySQL, and deal with the limitations in their code in exchange for improvement in performance and licensing cost savings.Around 1999–2000 a separate pany named MySQL AB was established. It hired several developers and established a partnership with Sleepycat to provide an SQL interface for the Berkeley DB data files. Since Berkeley DB had transaction capabilities,this would give MySQL support for transactions, which it previously some changes in the code in preparation for integrating Berkeley DB,version was released.Although the MySQL developers could never work out all the quirks of the Berkeley DB interface and the Berkeley DB tables were never stable, the effort was not a result, MySQL source became equipped with hooks to add any type of storage engine, including a transactional one.Version was released as alpha in April of 2003, and was declared beta in June of 2004. Unlike version , it added a number of significant improvements. Perhaps the most significant was subqueries, a feature longawaited by many users. Spatial indexing support was added to the MyISAM storage engine. Unicode support was implemented. The client/server protocol saw a number of changes. It was made more secure against attacks, and supported prepared statements.In parallel with the alpha version of , work progressed on yet another development branch: version , which would add stored procedures, serverside cursors,triggers, views, XA transactions, significant improvements in the query optimizer,and a number of other features. The decision to create a separate development branch was made because MySQL developers felt that it would take a long time to stabilize if, on top of all the new features that they were adding to it, they had to deal with the stored procedures. Version was finally released as alpha in December 2003. For a while this created quite a bit of confusion—there were two branches in the alpha stage. Eventually stabilized (October 2004), and the confusion was resolved.Version stabilized a year later, in October of 2005.The first alpha release of followed in November 2005, which added a number of improvements, some of which are table data partitioning, rowbased replication,event scheduler, and a standardized plugin API that facilitates the integration of new storage engines and other plugins.At this point, MySQL is being actively developed. is currently the stable version,while is in beta and should soon bee stable. New features at this point go into version .MySQL ArchitectureFor the large part, MySQL architecture defies a formal definition or most of the code was originally written, it was not done to be a part of some great system in the future, but rather to solve some very specific problems. However,it was written so well and with enough insight that it reached the point where there were enough quality pieces to assemble a database server.Core ModulesI make an attempt in this section to identify the core modules in the system. However,let me add a disclaimer that this is only an attempt to formalize what developers rarely think in those terms. Rather, they tend to think of files,directories, classes, structures, and functions. It is much more mon to hear “This happens in mi_open( )” than to hear “This happens on the MyISAM storage engine level.” MySQL developers know the code so well that they are able to think conceptually on the level of functions, structures, and classes. They will probably find the abstractions in this section rather useless. However, it would be helpful to a person used to thinking in terms of modules and managers.With regard to MySQL, I use the term “module” rather loosely. Unlike what one would typically call a module, in many cases it is not something you can easily pull out and replace with another implementation. The code from one module might be spread across several files, and y