MySQLHistoryandArchitectureMySQLhistorygoesbackto1979whenMontyWidenius,workingforasmallcompanycalledTcX,createdareportingtoolwritteninBASICthatranona4Mhzcomputerwith16KBRAM.Overtime,thetoolwasrewritteninCandportedtorunonUnix.Itwasstilljustalow-levelstorageenginewithareportingfrontend.ThetoolwasknownbythenameofUnireg.Workingundertheadverseconditionsoflittlecomputationalresources,andperhapsbuildingonhisGod-giventalent,Montydevelopedahabitandabilitytowriteveryefficientcodenaturally.Healsodeveloped,orperhapswasgiftedfromthestart,withanunusuallyacutevisionofwhatneededtobedonetothecodetomakeitusefulinfuturedevelopment—withoutknowinginadvancemuchdetailaboutwhatthatfuturedevelopmentwouldbe.Inadditiontotheabove,withTcXbeingaverysmallcompanyandMontybeingoneoftheowners,hehadalotofsayinwhathappenedtohiscode.WhilethereareperhapsagoodnumberofprogrammersouttherewithMonty’stalentandability,foranumberofreasons,fewgettocarrytheircodearoundformorethan20years.Montydid.Monty’swork,talents,andownershipofthecodeprovidedafoundationuponwhichtheMiracleofMySQLcouldbebuilt.Sometimeinthe1990s,TcXcustomersbegantopushforanSQLinterfacetotheirdata.Severalpossibilitieswereconsidered.Onewastoloaditintoacommercialdatabase.Montywasnotsatisfiedwiththespeed.HetriedborrowingmSQLcodefortheSQLpartandintegratingitwithhislow-levelstorageengine.Thatdidnotworkwell,either.Thencametheclassicmoveofatalented,drivenprogrammer:“I’vehadenoughofthosetoolsthatsomebodyelsewrotethatdon’twork!I’mwritingmyown!”ThusinMayof1996MySQLversion1.0wasreleasedtoalimitedgroup,followedbyapublicreleaseinOctober1996ofversion3.11.1.TheinitialpublicreleaseprovidedonlyabinarydistributionforSolaris.Amonthlater,thesourceandtheLinuxbinarywerereleased.Inthenexttwoyears,MySQLwasportedtoanumberofotheroperatingsystemsasthefeaturesetgraduallyincreased.MySQLwasoriginallyreleasedunderaspeciallicensethatallowedcommercialusetothosewhowerenotredistributingitwiththeirsoftware.Speciallicenseswereavailableforsaletothosewhowantedtobundleitwiththeirproduct.Additionally,commercialsupportwasalsobeingsold.ThisprovidedTcXwithsomerevenuetojustifythefurtherdevelopmentofMySQL,althoughthepurposeofitsoriginalcreationhadalreadybeenfulfilled.DuringthisperiodMySQLprogressedtoversion3.22.ItsupportedadecentsubsetoftheSQLlanguage,hadanoptimizeralotmoresophisticatedthanonewouldexpectcouldpossiblybewrittenbyoneperson,wasextremelyfast,andwasverystable.NumerousAPIswerecontributed,soonecouldwriteaclientinprettymuchanyexistingprogramminglanguage.However,itstilllackedsupportfortransactions,subqueries,foreignkeys,storedprocedures,andviews.Thelockinghappenedonlyatatablelevel,whichinsomecasescouldslowitdowntoagrindinghalt.Someprogrammersunabletogetarounditslimitationsstillconsidereditatoy,whileothersweremorethanhappytodumptheirOracleorSQLServerinfavorofMySQL,anddealwiththelimitationsintheircodeinexchangeforimprovementinperformanceandlicensingcostsavings.Around1999–2000aseparatecompanynamedMySQLABwasestablished.IthiredseveraldevelopersandestablishedapartnershipwithSleepycattoprovideanSQLinterfacefortheBerkeleyDBdatafiles.SinceBerkeleyDBhadtransactioncapabilities,thiswouldgiveMySQLsupportfortransactions,whichitpreviouslylacked.AftersomechangesinthecodeinpreparationforintegratingBerkeleyDB,version3.23wasreleased.AlthoughtheMySQLdeveloperscouldneverworkoutallthequirksoftheBerkeleyDBinterfaceandtheBerkeleyDBtableswereneverstable,theeffortwasnotwasted.Asaresult,MySQLsourcebecameequippedwithhookstoaddanytypeofstorageengine,includingatransactionalone.ByAprilof2000,withsomeencouragementandsponsorshipfromSlashdot,master-slavereplicationcapabilitywasadded.Theoldnontransactionalstorageengine,ISAM,wasreworkedandreleasedasMyISAM.Amonganumberofimprovements,full-textsearchcapabilitieswerenowsupported.Ashort-livedpartnershipwithNuSpheretoaddGemini,atransactionalenginewithrow-levellocking,endedinalawsuittowardtheendof2001.However,aroundthesametime,HeikkiTuuriapproachedMySQLABwithaproposaltointegratehisownstorageengine,InnoDB,whichwasalsocapableoftransactionsandrow-levellocking.Heikki’scontributionintegratedmuchmoresmoothlywiththenewtablehandlerinterfacealreadypolishedoffbytheBerkeleyDBintegrationefforts.TheMySQL/InnoDBcombinationbecameversion4.0,andwasreleasedasalphainOctoberof2001.Byearly2002theMySQL/InnoDBcombowasstableandinstantlytookMySQLtoanotherlevel.Version4.0wasfinallydeclaredproductionstableinMarch2003.ItmightbeworthyofmentionthattheversionnumberchangewasnotcausedbytheadditionofInnoDB.MySQLdevelopershavealwaysviewedInnoDBasanimportantaddition,butbynomeanssomethingthattheycompletelydependonforsuccess.Backthen,andevennow,theadditionofanewstorageengineisnotlikelytobecelebratedwithaversionnumberchange.Infact,comparedtopreviousversions,notmuchwasaddedinversion4.0.Perhapsthemostsignificantadditionwasthequerycache,whichgreatlyimprovedperformanceofalargenumberofapplications.Replicationcodeontheslavewasrewrittentousetwothreads:onefornetworkI/Ofromthemaster,andtheothertoprocesstheupdates.Someimprovementswereaddedtotheoptimizer.Theclient/serv