版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
ApproximationTechniquesforDataManagementSystems“Wearedrowningindatabutstarvedforknowledge”JohnNaisbittCS186Fall2005TraditionalQueryProcessingExactanswersNOTalwaysrequiredDSSapplicationsusuallyexploratory:earlyfeedbacktohelpidentify“interesting”regionsAggregatequeries:precisionto“l(fā)astdecimal”notneedede.g.,“WhatpercentageoftheUSsalesareinNJ?”SQLQueryExactAnswerDecision
Support
Systems
(DSS)LongResponseTimes!GB/TBPrimarilyforAggregatequeriesGoalistoquicklyreporttheleadingdigitsofanswersInsecondsinsteadofminutesorhoursMostusefulifcanprovideerrorguaranteesE.g.,Averagesalary
$59,000+/-$500(with95%confidence)in10secondsvs.$59,152.25in10minutesAchievedbyansweringthequerybasedoncompactsynopsesofthedataSpeed-upobtainedbecausesynopsesareordersofmagnitudesmallerthantheoriginaldataFastApproximateAnswersApproximateQueryProcessingHowdoyoubuildeffectivedatasynopses???SQLQueryExactAnswerDecision
Support
Systems
(DSS)LongResponseTimes!GB/TBCompactDataSynopses“Transformed”QueryKB/MBApproximateAnswerFAST!!Sampling:BasicsIdea:AsmallrandomsampleSofthedataoftenwell-representsallthedataForafastapproxanswer,applythequerytoS&“scale”theresultE.g.,R.ais{0,1},Sisa20%sample selectcount(*)fromRwhereR.a=0 select5*count(*)fromSwhereS.a=0110111110000111110111010110110Red=inSR.aEst.count=5*2=10,Exactcount=10Unbiased:Forexpressionsinvolvingcount,sum,avg:theestimatorisunbiased,i.e.,theexpectedvalueoftheansweristheactualanswer,evenfor(most)querieswithpredicates!LeverageextensiveliteratureonconfidenceintervalsforsamplingActualansweriswithintheinterval[a,b]withagivenprobability
E.g.,54,000±600withprob90%Sampling:ConfidenceIntervalsIfpredicates,SaboveissubsetofsamplethatsatisfiesthepredicateQualityoftheestimatedependsonlyonthe
varianceinR&|S|afterthepredicate:So10Ksamplemaysufficefor10Browrelation!Advantageoflargersamples:canhandlemoreselectivepredicatesGuarantees?90%ConfidenceInterval(±)Methodas(S)(R)3.16*(S)/sqrt(|S|)Chebyshev(est.(R))always3.16*(R)/sqrt(|S|)Chebyshev(known(R))always1.22*(MAX-MIN)/sqrt(|S|)Hoeffdingas|S|
1.65*(S)/sqrt(|S|)CentralLimitTheoremConfidenceintervalsforAverage:selectavg(R.A)fromR(CanreplaceR.AwithanyarithmeticexpressionontheattributesinR)(R)=standarddeviationofthevaluesofR.A;(S)=s.d.forS.ASamplingfromDatabasesSamplingdisk-residentdataisslowRow-levelsamplinghashighI/Ocost:
mustbringinentirediskblocktogettherowBlock-levelsampling:rowsmaybehighlycorrelatedRandomaccesspattern,possiblyviaanindexNeedtoaccountforthevariablenumberofrowsinapage,childreninanindexnode,etc.AlternativesRandomphysicalclustering:destroys“natural”clusteringPrecomputedsamples:mustincrementallymaintain(atspecifiedsize)Fasttouse:packedindiskblocks,cansequentiallyscan,canstoreasrelationandleveragefullDBMSquerysupport,canstoreinmainmemoryOne-PassUniformSamplingBestchoiceforincrementalmaintenanceLowoverheads,norandomdataaccessReservoirSampling[Vit85]:MaintainsasampleSofafixed-sizeMAddeachnewitemtoSwithprobabilityM/N,whereNisthecurrentnumberofdataitemsIfaddanitem,evictarandomitemfromSInsteadofflippingacoinforeachitem,determinethenumberofitemstoskipbeforethenexttobeaddedtoSHistogramsPartitionattributevalue(s)domainintoasetofbucketsIssues:HowtopartitionWhattostoreforeachbucketHowtoestimateananswerusingthehistogramLonghistoryofuseforselectivityestimationwithinaqueryoptimizerRecentlyexploredasatoolforfastapproximatequeryprocessing1-DHistogramsNumberofbucketsB<<domainsizeEachbucketjuststoresatotalcountDistributeduniformlyacrossvaluesinthebucketPartitioncriteriaEqui-width:equalnumberofdomainvaluesperbucket(bad!!)Equi-depth/height:equalcount(“mass”)perbucketV-Optimal:minimizetotalvarianceofvaluecountsinbucketsCountinbucketDomainvalues1234567891011121314151617181920AnsweringQueriesUsingHistogramsAnsweringqueriesfrom1-Dhistograms(ingeneral):(Implicitly)mapthehistogrambacktoanapproximaterelation,&applythequerytotheapproximaterelationInsideeachbucket:UniformityAssumptionContinuousvaluemapping12345678910111213141516171819201234567891011121314151617181920Neednumberofdistinctineachbucket321231Countspreadevenlyamongbucketvalues-Uniformspreadmapping4R.A15HaarWaveletSynopsesWavelets:mathematicaltoolforhierarchicaldecompositionoffunctions/signalsHaarwavelets:simplestwaveletbasis,easytounderstandandimplementRecursivepairwiseaveraginganddifferencingatdifferentresolutionsResolutionAveragesDetailCoefficientsD=[2,2,0,2,3,5,4,4][2,1,4,4][0,-1,-1,0][1.5,4][0.5,0][2.75][-1.25]3210Haarwaveletdecomposition:[2.75,-1.25,0.5,0,0,-1,-1,0]HaarWaveletCoefficientsHierarchicaldecompositionstructure(a.k.a.ErrorTree)Conceptualtoolto“visualize”coefficientsupports&datareconstructionReconstructdatavaluesd(i)d(i)=(+/-1)*(coefficientonpath)Rangesumcalculationd(l:h)d(l:h)=simplelinearcombinationofcoefficientsonpathstol,hOnlyO(logN)terms22023544-1.252.750.500-10-1+-+++++++------
Originaldata3=2.75-(-1.25)+0+(-1)6=4*2.75+4*(-1.25)WaveletDataSynopsesComputeHaarwaveletdecompositionofDCoefficientthresholding:onlyB<<|D|coefficientscanbekeptBisdeterminedbytheavailablesynopsisspaceApproximatequeryenginecandoallitsprocessingoversuchcompactcoefficientsynopses(joins,aggregates,selections,etc.)Conventionalthresholding:TakeBlargestcoefficientsinabsolute
normalizedvalue
NormalizedHaarbasis:dividecoefficientsatresolutionjbyAllothercoefficientsareignored(assumedtobezero)ProvablyoptimalintermsoftheoverallSum-Squared(L2)ErrorMulti-dimensionalDataSynopsesProblem:ApproximatethejointdatadistributionofmultipleattributesMotivationSelectivityestimationforquerieswithmultiplepredicatesApproximatinggeneralrelations1020403590120AgeSalaryConventionalapproach:Attribute-ValueIndependence(AVI)assumptionsel(p(A1)&p(A2)&...)=sel(p(A1))*sel(p(A2)*...Simple--one-dimensionalmarginalssufficeBUT:almostalwaysinaccurate,grosserrorsinpracticeMulti-dimensionalHistogramsUsesmallnumberofmulti-dimensionalbucketstodirectlyapproximatethejointdatadistributionUniformspread&frequencyapproximationwithinbucketsn(i)=no.ofdistinctvaluesalongAi,F=totalbucketfrequencyapproximatedatapointsonan(1)*n(2)*...uniformgrid,eachwithfrequencyF/(n(1)*n(2)*...)1020403590120ActualDistribution(ONEBUCKET)16ApproximateDistributionDataSynopsesinCommercialDBMSsSamplingoperatorsans1-DhistogramsareavailableinmostcommercialDBMSsOracle,DB2,SQLServer,…Usedinternallybutalsoexposedtouser(e.g.,store“sampleview”)SQLServerhassupportfor2-Dhistograms!Thenextstep:SynopsesforXML!?!Howdoyoueffectivelysummarizeagraphstructureforquerieslike“//a//b[d]/*/c”??Data-StreamManagementTraditionalDBMS–datastoredinfinite,persistent
datasets
DataStreams–distributed,continuous,unbounded,rapid,timevarying,noisy,...Data-StreamManagement–varietyofmodernapplicationsNetworkmonitoringandtrafficengineeringTelecomcall-detailrecordsNetworksecurityFinancialapplicationsSensornetworksWeblogsandclickstreamsNetworksGenerateMassiveDataStreamsBroadband
InternetAccessConvergedIP/MPLSNetworkPSTNDSL/CableNetworksEnterprise
NetworksVoiceoverIPFR,ATM,IPVPNNetworkOperationsCenter(NOC)SNMP/RMON,NetFlowrecordsBGPOSPFPeerSNMP/RMON/NetFlowdatarecordsarrive24x7fromdifferentpartsofthenetworkTrulymassivestreamsarrivingatrapidratesAT&Tcollects600-800GigaBytesofNetFlowdataeachday!Typicallyshippedtoaback-enddatawarehouse(offsite)foroff-lineanalysisSourceDestination
Duration
BytesProtocol1220Khttp1624Khttp1520Khttp1940Khttp2658Khttp27100Kftp32300Kftp1880KftpExampleNetFlowIPSessionDataReal-TimeData-StreamAnalysisNeedabilitytoprocess/analyzenetwork-datastreamsinreal-time
Asrecordsstreamin:lookatrecordsonlyonceinarrivalorder!Withinresource(CPU,memory)limitationsoftheNOCCriticaltoimportantNMtasksDetectandreacttoFraud,Denial-of-Serviceattacks,SLAviolationsReal-timetrafficengineeringtoimproveload-balancingandutilizationDBMS(Oracle,DB2)Back-endDataWarehouseOff-lineanalysis–Dataaccessisslow,expensiveConvergedIP/MPLSNetworkPSTNDSL/CableNetworksEnterprise
NetworksNetworkOperationsCenter(NOC)BGPPeerR1R2R3Whatarethetop(mostfrequent)1000(source,dest)pairsseenbyR1overthelastmonth?SELECTCOUNT(R1.source,R1.dest)FROMR1,R2WHERER1.source=R2.sourceSQLJoinQueryHowmanydistinct(source,dest)pairshavebeenseenbybothR1andR2butnotR3?Set-ExpressionQueryData-Stream
Processing
ModelApproximateanswersoftensuffice,e.g.,trendanalysis,anomalydetectionRequirementsforstreamsynopsesSinglePass:Eachrecordisexaminedatmostonce,in(fixed)arrivalorderSmall
Space:LogorpolylogindatastreamsizeReal-time:Per-recordprocessingtime(tomaintainsynopses)mustbelow
StreamProcessingEngineApproximateAnswerwithErrorGuarantees“Within2%ofexactanswerwithhighprobability”StreamSynopses(inmemory)ContinuousDataStreamsQueryQR1Rk(GBs/TBs)(KBs)DistinctValueEstimationProblem:Findthenumberofdistinctvaluesinastreamofvalueswithdomain[0,...,N-1]Zerothfrequencymoment,L0(Hamming)streamnormStatistics:numberofspeciesorclassesinapopulationImportantforqueryoptimizersNetworkmonitoring:distinctdestinationIPaddresses,source/destinationpairs,requestedURLs,etc.Example(N=64)Hardproblemforrandomsampling![CCMN00]Mustsamplealmosttheentiretabletoguaranteetheestimateiswithinafactorof10withprobability>1/2,regardlessoftheestimatorused!Datastream:305301751037Numberofdistinctvalues:5Assumeahashfunctionh(x)thatmapsincomingvaluesxin[0,…,N-1]uniformlyacross[0,…,2^L-1],whereL=O(logN)Letlsb(y)denotethepositionoftheleast-significant1bitinthebinaryrepresentationofyAvaluexismappedtolsb(h(x))MaintainHashSketch=BITMAParrayofLbits,initializedto0Foreachincomingvaluex,setBITMAP[lsb(h(x))]=1Hash(akaFM)SketchesforCountDistinctx=5h(x)=101100lsb(h(x))=2000001BITMAP543210Hash(akaFM)SketchesforCountDistinctByuniformitythroughh(x):Prob[BITMAP[k]=1]=Prob[]=Assumingddistinctvalues:expectd/2tomaptoBITMAP[0],d/4tomaptoBITMAP[1],...LetR=
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 醫(yī)療器械居間服務協(xié)議合同
- 美食推廣居間合同
- 人工智能翻譯服務合同
- 5G通信基礎設施建設合作協(xié)議
- 網(wǎng)絡安全服務外包合作協(xié)議
- 旅游人力資源管理咨詢服務協(xié)議
- 特殊教育學校師生安全責任協(xié)議
- 智能物流系統(tǒng)優(yōu)化項目協(xié)議
- 家具設計研發(fā)生產(chǎn)銷售合作協(xié)議書
- 智能廣告投放系統(tǒng)開發(fā)合同
- 工程質(zhì)保金返還審批單
- 【可行性報告】2023年電動自行車項目可行性研究分析報告
- 五月天歌詞全集
- 商品退換貨申請表模板
- 實習單位鑒定表(模板)
- 六西格瑪(6Sigma)詳解及實際案例分析
- 機械制造技術-成都工業(yè)學院中國大學mooc課后章節(jié)答案期末考試題庫2023年
- 數(shù)字媒體應用技術專業(yè)調(diào)研方案
- 2023年常州市新課結(jié)束考試九年級數(shù)學試卷(含答案)
- 正常分娩 分娩機制 助產(chǎn)學課件
- 廣東縣級農(nóng)商銀行聯(lián)社高管候選人公開競聘筆試有關事項上岸提分題庫3套【500題帶答案含詳解】
評論
0/150
提交評論