Taking IO seriously Resolution reconsidered for di

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

TakingI/OSeriously:ResolutionReconsideredforDiskJulianaFreire,TerranceSwiftandDavidS.WarrenDepartmentofComputerScienceStateUniversityofNewYorkatStonyBrookfjuliana,tswift,warreng@cs.sunysb.eduAbstractModerncompilationtechniquescangivePrologprograms,inthebestcases,aspeedcomparabletoC.However,Prologhasproventobeunacceptablefordata-orientedqueriesfortwomajorreasons:itspoorterminationandcomplexitypropertiesforDatalog,anditstuple-at-a-timestrategy.Anumberoftablingframeworksandsystemshaveaddressedtherstproblem,includingtheXSBsystemwhichhasachievedPrologspeedsfortabledprograms.YettablingsystemssuchasXSBcontinuetousethetuple-at-a-timeparadigm.Asaresult,thesesystemsarenotamenabletoatightinterconnectionwithdisk-residentdata.However,inatablingframeworkthedierencebetweentuple-at-a-timebehaviorandset-at-a-timecanbeviewedasoneofscheduling.Accordingly,wedeneabreadth-rstset-at-a-timetablingstrategyandproveititerationequivalenttoaformofsemi-naivemagicevaluation.Thatis,weextendthewell-knownasymptoticresultsofSeki[10]byprovingthateachiterationofthetablingstrategyproducesthesameinformationassemi-naivemagic.Further,thisset-at-a-timeschedulingisamenabletoimplementationinanenginethatusesPrologcompilation.Wedescribeboththeengineanditsperformance,whichiscomparablewiththetuple-at-a-timestrategyevenforin-memoryDatalogqueries.BecauseofitsperformanceanditsnelevelofintegrationofPrologwithadatabase-stylesearch,theset-at-a-timeengineappearsasanimportantkeytolinkinglogicprogramminganddeductivedatabases.1IntroductionItisoftennecessarytoleavetherelationalmodeltoreasonaboutthecontentsofadatabase,aproblemwhichdeductivedatabasesseektoremedy.Deductivedatabaseschooseastheirdatamodelrst-orderlogicorarestrictionsuchasDat-alog.First-orderlogichasprovenexpressiveasadataquerylanguage,andmanyevaluationstrategies,mostnotablymagicevaluation,havebeendevelopedtoem-bedrecursivegoal-orientationintheframeworkofdatabaseevaluation.Whilemagicaddsgoal-orientationtodatabaseevaluation,tablingmethodshaveaddedfeaturesofdatabaseevaluationtologicprogramminglanguages.Magicevaluationcloselyresemblestabling.Bothmagicandtablingcombinetop-downgoalorientationwithbottom-upredundancychecking.Indeed,forrange-restrictedprograms,theyhavebeenproventobeasymptoticallyequivalent[10,8]undercertainassumptions.Despitethesewell-knownequivalences,magic-stylesys-temshavetraditionallydieredfromtablingsystems.Magic-stylesystems,suchasAditi[15],CORAL[7],andLDL[3],arebuiltuponset-at-a-timesemi-naiveengines,whiletablingsystems,suchasXSB[9],useatuple-at-a-timestrategythatreectstheirgenesisinthelogicprogrammingcommunity.Eachclassofsystemshasitsadvantagesanddisadvantages.Presentlyforin-memoryDatalogqueries,thefastesttablingsystemsshowanorderofmagnitudespeedupovermagic-stylesystemsduetothetablingsystems’useofPrologcompilationtechnology[9].How-ever,thetuple-at-a-timestrategyoftablingsystemsisnotecientlyextendibletodisk.Acloselookattablingindicatesthatthereisnoreasonwhyaset-at-a-timestrategycannotbecloselyintegratedintoatablingengine.Doingsooerstremen-dousadvantages.In-memorypredicatescanbeevaluatedatthebestin-memoryspeeds,whilequeriestodiskhavethesameaccesspatternsasthebestset-at-a-timemethods.Furthermore,bothoftheseapproachescanbeintegratedfullyintothewell-knownPrologenvironment.ThispaperpresentsboththeoreticalandpracticalresultsonusingPrologcompilationtechnologytoecientlyimplementaset-at-a-timetablingsystemfordeniteprograms.Themajorresultsofthispaperare:DerivationofaTightEquivalencebetweenTablingandtheSemi-NaiveEvaluationofaMagic-TransformedProgram(SNMT).Broadequivalencesbetweentablingandmagic-stylemethodshavelongbeenknown.In[10]SekiobtainedanasymptoticequivalencebetweenanaiveevaluationofaprogramrewrittenusingAlexanderTemplatesandaversionofatablingmethod.Afterspecifyingabreadth-rstsearchstrategyfortabling,weextendtheequivalenceofSekiintwoways.First,weuseasemi-naiveevaluationratherthannaiveevaluationforboththetablingandtherewritemethod.Secondandmoreimportantly,wedeneanaturalmeasureofiterationequivalencebetweenset-at-a-timetablingandSNMT.Usingiterationequivalence,wedemonstratethateveryanswerofeveryiterationofourtablingstrategyisproducedatthecorrespondingiterationofSNMT.DesignandImplementationofanEnginetoEvaluateBreadth-FirstTabling.Othertablingmethodswithset-at-a-timepropertieshavebeendeveloped,mostnotablytheSLD-ALstrategyof[16].Inadditiontoiterationequivalencetomagic,theenginedescribedherehastheadvantageofusingthelow-leveldatastructuresandcompilationtechniquesofPrologtechnology.Aspresentedin[13],thistech-nology,asimplementedintheSLG-WAM,leadstoanextremelyfast,robust,andexibleimplementationofadeductivedatabaseengine.Theresultingimplementa-tionoftheBreadth-FirstXSBisavailableuponrequest.OtherversionsofXSBarecurrentlyinstalledatnearly1000registeredcommercial,academicandgovernmen-talsites.PerformanceAnalysisoftheSet-at-a-timeEngine.Surprisingly,theresultingset-at-a-timeengineisonlymarginallyslowerthanpreviouslypublishedSLG-WAMtimesforDatalogprogramswithin-memorydataonarepresentativeset

1 / 15
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功