背著手扇扇子的人
          往事隨風......前事如夢......
          posts - 35,  comments - 17,  trackbacks - 0

          有人問這樣的sql該怎么實現:
          表數據和結構
          ?? ?CODE?NAME????B01????S01????B02????S02
          ????1??????????張三???????數學????80??
          ????1??????????張三????????????????????????????語文????75
          ????2??????????王五???????數學????70??
          ????2??????????王五????
          ????3??????????李四???????數學????50??
          ????3??????????李四???????????????????????????語文????88

          希望查詢出如下結果:
          ?? ?CODE?SUM_STR(NAME)????B01????SUM_STR(S01)????B02????SUM_STR(S02)
          ????1????????????????張三????????????????????數學????????????????80?????????? 語文????????????75
          ????2????????????????王五????????????????????數學????????????????70??
          ????3????????????????李四????????????????????數學????????????????50?????????? 語文?????????????88
          這個問題可以采用自定義的聚集函數來實現:

          create ? or ? replace ?type?strcat_type? as ?object?(
          ????cat_string?
          varchar2 ( 4000 ),
          ????static?
          function ?ODCIAggregateInitialize(cs_ctx? In ?Out?strcat_type)? return ? number ,
          ????member?
          function ?ODCIAggregateIterate(self? In ?Out?strcat_type,value? in ? varchar2 )? return ?

          number ,
          ????member?
          function ?ODCIAggregateMerge(self? In ?Out?strcat_type,ctx2? In ?Out?strcat_type)?

          return ? number ,
          ????member?
          function ?ODCIAggregateTerminate(self? In ?Out?strcat_type,returnValue?Out?

          varchar2 ,flags? in ? number )? return ? number
          )
          /


          ------------------------------------

          create ? or ? replace ?type?body?strcat_type? is
          ??static?
          function ?ODCIAggregateInitialize(cs_ctx? IN ?OUT?strcat_type)? return ? number
          ??
          is
          ??
          begin
          ??????cs_ctx?:
          = ?strcat_type(? null ?);
          ??????
          return ?ODCIConst.Success;
          ??
          end ;

          ??member?
          function ?ODCIAggregateIterate(self? IN ?OUT?strcat_type,
          ???????????????????????????????????????value?
          IN ? varchar2 ?)
          ??
          return ? number
          ??
          is
          ??
          begin
          ??????
          if ?self.cat_string? is ? null ? then
          ?????????self.cat_string?:
          = ?value;
          ??????
          end ? if ;
          ??????
          return ?ODCIConst.Success;
          ??
          end ;

          ??member?
          function ?ODCIAggregateTerminate(self? IN ?Out?strcat_type,
          ?????????????????????????????????????????returnValue?OUT?
          varchar2 ,
          ?????????????????????????????????????????flags?
          IN ? number )
          ??
          return ? number
          ??
          is
          ??
          begin
          ??????returnValue?:
          = ?self.cat_string;
          ??????
          return ?ODCIConst.Success;
          ??
          end ;

          ??member?
          function ?ODCIAggregateMerge(self? IN ?OUT?strcat_type,
          ?????????????????????????????????????ctx2?
          IN ?Out?strcat_type)
          ??
          return ? number
          ??
          is
          ??
          begin
          ?????? if self.cat_string is null then
          ?????????????????? self.cat_string :=? ctx2.cat_string;
          ????????? end if;
          ?????? return ?ODCIConst.Success;
          ??
          end ;

          end ;
          /

          -------------------

          CREATE ? OR ? REPLACE ? FUNCTION ?sum_str(input? varchar2 ?)
          RETURN ? varchar2
          PARALLEL_ENABLE?AGGREGATE?USING?strcat_type;
          /

          -------最后查詢語句:

          select ?code,sum_str(name),?sum_str(b01)?b01,sum_str(s01)?,sum_str(b02)?b02,sum_str(s02)
          from ?javaeye? group ? by ?code? order ? by ?code
          posted @ 2009-01-05 21:55 kebo 閱讀(979) | 評論 (4)編輯 收藏
          定義標注的樣式,這個決定標注顯示的方式,必須定義好
          ?1
          ?$package("com.bct.map");
          ?2?com.bct.map.EncoderMarkerStyle?=?{
          ?3?????'bigEncoder':{
          ?4?????????graphicWidth:24,
          ?5?????????graphicHeight?:?24,
          ?6?????????graphicXOffset?:?-12,
          ?7?????????graphicYOffset?:?-24,
          ?8?????????externalGraphic?:?"scripts/map/img/channel2.png"
          ?9?????},
          10?????'smallEncoder':{
          11?????????graphicWidth:16,
          12?????????graphicHeight?:?16,
          13?????????graphicXOffset?:?-8,
          14?????????graphicYOffset?:?-16,
          15?????????externalGraphic?:?"scripts/map/img/channel.gif"
          16?????},
          17?????'selectStyle':{
          18?????????pointerEvents:?"visiblePainted",
          19?????????border:"border:25?outset?#ff88ff",
          20?????????cursor:?"pointer",
          21?????????graphicWidth:24,
          22?????????graphicHeight?:?24,
          23?????????graphicXOffset?:?-12,
          24?????????graphicYOffset?:?-24,
          25?????????externalGraphic?:?"scripts/map/img/channel2.png"????
          26?????},
          27?????styleMap:?new?OpenLayers.StyleMap({
          28?????????????????????"select":?new?OpenLayers.Style({pointRadius:?24})
          29?????})
          30?}

          marker層,擴展vector層,通過point和style達到marker的效果
          ??1?$package("com.bct.map");
          ??2?$import("com.bct.map.EncoderMarkerStyle");
          ??3?com.bct.map.MarkerVectorLayer?=?OpenLayers.Class(OpenLayers.Layer.Vector,{
          ??4?????/**
          ??5??????*?parameters
          ??6??????*?attribute?filer對象
          ??7??????*/
          ??8?????getFeatureByAttribute?:function(attributes){
          ??9?????????var?feature?=?null;
          ?10?????????for(var?i=0;i<this.features.length;?++i){
          ?11?????????????var?attri?=?this.features[i].attributes;
          ?12?????????????var?find?=?false;
          ?13?????????????for(var?j?in?attributes){
          ?14?????????????????if(attributes[j]?==?attri[j]){
          ?15?????????????????????find?=?true;
          ?16?????????????????}
          ?17?????????????}
          ?18?????????????if(find){
          ?19?????????????????return?this.features[i];?
          ?20?????????????}????????????
          ?21?????????}
          ?22?????
          ?23?????},
          ?24?????addEncorderFeature:function(encNode,location){
          ?25?????????if(encNode&&this.repetitiveCheck(encNode.id)){
          ?26?????????????return;
          ?27?????????}
          ?28?????????var?attributes?=?OpenLayers.Util.extend({},?encNode.attributes);
          ?29?????????var?enc_point?=?new?OpenLayers.Geometry.Point(location.lon,location.lat);
          ?30?????????var?enc_Feature?=?new?OpenLayers.Feature.Vector(enc_point,attributes,com.bct.map.EncoderMarkerStyle['smallEncoder']);
          ?31?????????this
          .addFeatures([enc_Feature]);
          ?32?????????if(encNode.attributes['lon']&&encNode.attributes['lat']&&encNode.attributes['lon'].length>0){
          ?33?????????????return;
          ?34?????????}
          ?35?????????this.updateChannel(encNode.id,location.lon,location.lat);
          ?36?????},
          ?37?????addDeptFeature:function(deptNode,location){
          ?38?????????if(deptNode&&this.repetitiveCheck(deptNode.id)){
          ?39?????????????return;
          ?40?????????}
          ?41?????????var?attributes?=?OpenLayers.Util.extend({},?deptNode.attributes);
          ?42?????????var?enc_point?=?new?OpenLayers.Geometry.Point(location.lon,location.lat);
          ?43?????????var?enc_Feature?=?new?OpenLayers.Feature.Vector(enc_point,attributes,com.bct.map.EncoderMarkerStyle['smallEncoder']);
          ?44?????????
          ?45?????????this.addFeatures([enc_Feature]);
          ?46?????????
          ?47?????},
          ?48?????repetitiveCheck:function(entity_id){
          ?49?????????if(this.getFeatureByAttribute({id:entity_id})){
          ?50?????????????return?true;
          ?51?????????}
          ?52?????????return?false;
          ?53?????},
          ?54?????updateChannel:function(channel_id,lon,lat){
          ?55?????????Ext.Ajax.request({
          ?56????????????????url:?'deviceVideoEncoder.do?method=updateLonlat&id='+channel_id+"&lon="+lon+"&lat="+lat
          ?57?????????});
          ?58?????},
          ?59?????channelMarkerClick:function()?{
          ?60?????????var?features?=?this.selectedFeatures;
          ?61?????????if(features.length?>=0&&features[0])?{
          ?62?????????????feature?=?features[0];????????????
          ?63?????????????var?treeNodeAttribute?=?feature.attributes;
          ?64?????????????var?vedioPopForm?=?new?Ext.FormPanel({
          ?65????????????????????????????????????frame:true,
          ?66?????????????????????????????????labelAlign:?'top',
          ?67?????????????????????????????????bodyStyle:'padding:5px',
          ?68?????????????????????????????????width:?400,
          ?69?????????????????????????????????height:200,
          ?70?????????????????????????????????layout:?'fit',
          ?71?????????????????????????????????items:[{
          ?72?????????????????????????????????????????????xtype:'fieldset',
          ?73?????????????????????????????????????????????title:?'攝像頭信息',
          ?74?????????????????????????????????????????????autoHeight:true,
          ?75?????????????????????????????????????????????autoWidth:true,
          ?76?????????????????????????????????????????????html:"<p><font?color='red'?size='2'>名稱:"+treeNodeAttribute['text']
          ?77?????????????????????????????????????????????+"</font></p><p><font?color='red'?size='2'>通道號:"+treeNodeAttribute['channelNumber']
          ?78?????????????????????????????????????????????+"</font></p><p><font?color='red'?size='2'>設備名稱:"+treeNodeAttribute['deviceunitName']
          ?79?????????????????????????????????????????????+"</font></p><p><font?color='red'?size='2'>所屬部門:"+treeNodeAttribute['deptName']
          ?80?????????????????????????????????????????????+"</font></p><p><font?color='red'?size='2'>經緯度:"+treeNodeAttribute['lon']+","+treeNodeAttribute['lat']
          ?81?????????????????????????????????????}]
          ?82?????????????});
          ?83?????????????var?win?=?new?Ext.Window({
          ?84?????????????????width?:?420,
          ?85?????????????????height:?220,
          ?86?????????????????items?:?vedioPopForm
          ?87?????????????});
          ?88?????????????win.show();????????????
          ?89?????????}
          ?90?????},
          ?91?????cartoonFeature?:function(feature){
          ?92?????????this.drawFeature(feature,com.bct.map.EncoderMarkerStyle['bigEncoder']);
          ?93?????????var?runner?=?new?Ext.util.TaskRunner(1000);
          ?94?????????var?task?=?{
          ?95?????????????run:this.drawFeature,
          ?96?????????????scope:this,
          ?97?????????????args:[feature,com.bct.map.EncoderMarkerStyle['smallEncoder']],
          ?98?????????????interval:?1000
          ?99?????????}
          100?????????runner.start(task);
          101?????},
          102?????removeSelectFeature:function(){
          103?????????var?features?=?this.selectedFeatures;
          104?????????for(var?i=features.length-1;?i>=0;?i--)?{
          105?????????????feature?=?features[i];
          106?????????????this.updateChannel(feature.attributes['id'],"","");
          107?????????}
          108?????????this.destroyFeatures(this.selectedFeatures);
          109?????},
          110?????monitorSelectFeature:function(){????????
          111?????????var?features?=?this.selectedFeatures;
          112?????????if(features.length?>=0&&features[0])?{
          113?????????????feature?=?features[0];????????????
          114?????????????var?treeNodeAttribute?=?feature.attributes;
          115?????????????var?objId="mapAVShow"+treeNodeAttribute['id'];
          116?????????????var?win?=?new?Ext.Window({
          117?????????????????width?:?420,
          118?????????????????height:?420,
          119?????????????????html:"<div?id='mapEncoder'?width='100%'?height='100%'><object?width='100%'?height='100%'?id='"+objId+"'?classid='clsid:574B47E8-A366-4AB9-B2EA-57F145CA3780'></object></div>"
          120?????????????});????????????
          121?????????????win.show();
          122?????????????Ext.lib.Ajax.request('GET','channel.do?method=getSiteId&accept=json&id='+treeNodeAttribute['id'],
          123???????????????????????????????{success:?function(o){
          124?????????????????????????????????????????var?encoderObj;
          125?????????????????????????????????????????encoderObj=Ext.util.JSON.decode(o.responseText);
          126?????????????????????????????????????????$import("com.bct.monitor.mapAVShow");
          127?????????????????????????????????????????var?avshowObj=document.getElementById(objId);
          128?????????????????????????????????????????var?avshow=new?com.bct.monitor.mapAVShow(avshowObj,
          129?????????????????????????????????????????encoderObj[0].siteId,encoderObj[0].enCoderId,encoderObj[0].diveceUnitTypeId,'');
          130?????????????????????????????????????????avshow.startVideo();
          131?????????????????????????????????????????win.on("destroy",function?del(){
          132??????????????????????????????????????????????????????????avshow.stopVideo();
          133?????????????????????????????????????????});
          134?????????????????????????????????}
          135???????????????????????????????});?????????????
          136?????????}
          137?????}
          138?});


          posted @ 2008-09-04 14:12 kebo 閱讀(3956) | 評論 (1)編輯 收藏

          在項目進入性能測試階段,終于爆發了sql運行緩慢,系統吞吐量下降,甚至一度出現oracle服務器cpu100%的情況。具體開發和測試人員報告情況,開始介入處理。

          具體查找性能緩慢的過程略除。
          發現一條sql運行緩慢。通過跟蹤發現一下信息
          select alias_p2.pendingid, alias_p2.workitemid, alias_p2.operationid, alias_p2.operationkey,

          ? 2? alias_p2.title, alias_p2.sendercn, alias_p2.operatedes, alias_p2.pendingstate,

          ? 3? alias_p2.parameter, alias_p2.createdate, alias_p2.deptname, alias_p2.completeddate ,

          ? 4? alias_p2.openstate , alias_p2.name, alias_p2.processinstanceid, alias_p2.asset

          ? 5?? from ( select alias_p1.pendingid, alias_p1.workitemid, alias_p1.operationid,

          ? 6?? alias_p1.operationkey, alias_p1.title, alias_p1.sendercn, alias_p1.operatedes,

          ? 7??? alias_p1.pendingstate, alias_p1.parameter, alias_p1.createdate, alias_p1.deptname,

          ? 8????? alias_p1.completeddate , alias_p1.openstate , alias_p1.name, alias_p1.processinstanceid ,

          ? 9??????? alias_p1.asset , rownum rn from(select alias_p.pendingid, alias_p.workitemid, alias_p.operationid,

          ?10??????? alias_p.operationkey, alias_p.title, alias_p.sendercn, alias_p.operatedes, alias_p.pendingstate,

          ?11??????? alias_p.parameter, alias_p.createdate, alias_p.deptname, alias_p.completeddate , alias_p.openstate ,

          ?12???????? pd.name, w.processinstanceid , eam_db.concatassetname( alias_p.operationkey, alias_p.operationid )

          ?13????????? asset from WF_Pending alias_p, WF_WorkItem w, WF_ProcessDefinition pd, WF_ProcessInstance pi

          ?14????????? where alias_p.ownerid='qinxue'?? and alias_p.pendingstate in(0,3,5,7,9,10,11,12)

          ?15??????????? and (alias_p.deptname=' 審控部信息處 ' or alias_p.deptname='' or alias_p.deptname is null)

          ?16??????????? and w.workitemid = alias_p.workitemid?? and pi.processinstanceid = w.processinstanceid

          ?17? and pi.completeddate is null?? and pd.processdefinitionid = w.processdefinitionid? order by alias_p.createdate desc) alias_p1 where rownum <=10)

          alias_p2 where rn>=1;

          ?

          已選擇 10 行。

          ?

          ?

          執行計劃

          ----------------------------------------------------------

          ?? 0????? SELECT STATEMENT Optimizer=CHOOSE (Cost=10 Card=1 Bytes=2507

          ????????? )

          ?

          ?? 1??? 0?? VIEW (Cost=10 Card=1 Bytes=2507)

          ?? 2??? 1???? COUNT (STOPKEY)

          ?? 3??? 2?????? VIEW (Cost=10 Card=1 Bytes=2494)

          ?? 4??? 3???????? SORT (ORDER BY STOPKEY) (Cost=10 Card=1 Bytes=167)

          ?? 5??? 4?????????? NESTED LOOPS (Cost=8 Card=1 Bytes=167)

          ?? 6??? 5???????????? NESTED LOOPS (Cost=7 Card=1 Bytes=162)

          ?? 7??? 6?????????????? NESTED LOOPS (Cost=6 Card=1 Bytes=134)

          ?? 8??? 7???????????????? TABLE ACCESS (FULL) OF 'WF_PENDING' (Cost=5

          ????????? Card=1 Bytes=111)

          ?

          ?? 9??? 7???????????????? TABLE ACCESS (BY INDEX ROWID) OF 'WF_WORKITE

          ????????? M' (Cost=1 Card=3 Bytes=69)

          ?

          ? 10??? 9?????????????????? INDEX (UNIQUE SCAN) OF 'SYS_C003694' (UNIQ

          ????????? UE)

          ?

          ? 11??? 6?????????????? TABLE ACCESS (BY INDEX ROWID) OF 'WF_PROCESSDE

          ????????? FINITION' (Cost=1 Card=1 Bytes=28)

          ?

          ? 12?? 11???????????????? INDEX (UNIQUE SCAN) OF 'SYS_C003684' (UNIQUE

          ????????? )

          ?

          ? 13??? 5???????????? TABLE ACCESS (BY INDEX ROWID) OF 'WF_PROCESSINST

          ????????? ANCE' (Cost=1 Card=1 Bytes=5)

          ?

          ? 14?? 13?????????????? INDEX (UNIQUE SCAN) OF 'SYS_C003662' (UNIQUE)

          ?

          ?

          ?

          ?

          統計信息

          ----------------------------------------------------------

          ??????? 314? recursive calls

          ????????? 0? db block gets

          ???? ?29433? consistent gets

          ????????? 0? physical reads

          ???? ?????0? redo size

          ?????? 2153? bytes sent via SQL*Net to client

          ??????? 372? bytes received via SQL*Net from client

          ????????? 2? SQL*Net roundtrips to/from client

          ??????? 101? sorts (memory)

          ????????? 0? sorts (disk)

          ???????? 10? rows processed

          其中一致讀達到近3萬次,關聯調用出現314次。排序數值也非常多,顯然第一目標是把這兩個數據降下來。
          通過進一步的分析。發現出現這些問題的主要原因是調用eam_db.concatassetname( alias_p.operationkey, alias_p.operationid )這個包。
          開始考慮直接在sql外層做關聯,不用function來實現。利用聚集函數來合并數據。
          著手建立:

          聚集函數:?CREATE OR REPLACE FUNCTION F_ASSETLINK(P_STR VARCHAR2) RETURN VARCHAR2
          AGGREGATE USING asset_link;


          ----------------------
          創建type:CREATE OR REPLACE TYPE ASSET_LINK AS OBJECT (
          STR VARCHAR2(30000),
          STATIC FUNCTION ODCIAGGREGATEINITIALIZE(SCTX IN OUT ASSET_LINK) RETURN NUMBER,
          MEMBER FUNCTION ODCIAGGREGATEITERATE(SELF IN OUT ASSET_LINK, VALUE IN VARCHAR2) RETURN NUMBER,
          MEMBER FUNCTION ODCIAGGREGATETERMINATE(SELF IN ASSET_LINK, RETURNVALUE OUT VARCHAR2, FLAGS IN NUMBER) RETURN NUMBER,
          MEMBER FUNCTION ODCIAGGREGATEMERGE(SELF IN OUT ASSET_LINK, CTX2 IN ASSET_LINK) RETURN NUMBER
          )
          ------------------------------------------------------

          創建type body:CREATE OR REPLACE TYPE BODY ASSET_LINK IS
          STATIC FUNCTION ODCIAGGREGATEINITIALIZE(SCTX IN OUT ASSET_LINK) RETURN NUMBER IS
          BEGIN
          SCTX := ASSET_LINK(NULL);
          RETURN ODCICONST.SUCCESS;
          END;
          MEMBER FUNCTION ODCIAGGREGATEITERATE(SELF IN OUT ASSET_LINK, VALUE IN VARCHAR2) RETURN NUMBER IS
          BEGIN
          SELF.STR := SELF.STR ||','|| VALUE;
          RETURN ODCICONST.SUCCESS;
          END;
          MEMBER FUNCTION ODCIAGGREGATETERMINATE(SELF IN ASSET_LINK, RETURNVALUE OUT VARCHAR2, FLAGS IN NUMBER) RETURN NUMBER IS
          BEGIN
          RETURNVALUE := SELF.STR;
          RETURN ODCICONST.SUCCESS;
          END;
          MEMBER FUNCTION ODCIAGGREGATEMERGE(SELF IN OUT ASSET_LINK, CTX2 IN ASSET_LINK) RETURN NUMBER IS
          BEGIN
          NULL;
          RETURN ODCICONST.SUCCESS;
          END;
          END;
          調整sql如下:
          select alias_p.pendingid, alias_p.workitemid, alias_p.operationid,
          ?? alias_p.operationkey, alias_p.title, alias_p.sendercn, alias_p.operatedes, alias_p.pendingstate,
          ?? alias_p.parameter, alias_p.createdate, alias_p.deptname, alias_p.completeddate , alias_p.openstate ,
          ?? pd.name, w.processinstanceid
          ?? --,T.ASSETCLASS3? ASSET??
          ?? ,f_assetlink(d3.typename) ASSET
          ?? --,eam_db.concatassetname( alias_p.operationkey, alias_p.operationid )? asset
          ?? from WF_Pending alias_p, WF_WorkItem w,
          ?? WF_ProcessDefinition pd, WF_ProcessInstance pi
          ?? , tb_asset_dizhiyihao T,dic_app_wfconfig wfc,dic_app_assettype3 d3
          ?? where alias_p.ownerid='qinxue'??
          ?? and alias_p.pendingstate in(0,3,5,7,9,10,11,12)
          ?? and (alias_p.deptname='審控部信息處' or alias_p.deptname='' or alias_p.deptname is null)
          ?? and w.workitemid = alias_p.workitemid??
          ?? and pi.processinstanceid = w.processinstanceid
          ?? and pi.completeddate is null??
          ?? and pd.processdefinitionid = w.processdefinitionid
          ?? AND??? t.pk_businessid = alias_p.operationid
          ????????? and alias_p.operationkey = wfc.memo_1
          ????????? and wfc.wfconfig_code = t.wfconfig_code
          ?? and t.assetclass3 = d3.assettype3_id
          ?? group by alias_p.pendingid, alias_p.workitemid, alias_p.operationid,
          ?? alias_p.operationkey, alias_p.title, alias_p.sendercn, alias_p.operatedes, alias_p.pendingstate,
          ?? alias_p.parameter, alias_p.createdate, alias_p.deptname, alias_p.completeddate , alias_p.openstate ,
          ?? pd.name, w.processinstanceid
          ?? order by alias_p.createdate desc
          得到統計數據如下:
          C:\Documents and Settings\ibm>sqlplus /nolog

          SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 9月 10 19:27:33 2007

          Copyright (c) 1982, 2005, Oracle.? All rights reserved.

          SQL> conn jic/jic@name
          已連接。
          SQL> set autotrace traceonly
          SQL> select alias_p.pendingid, alias_p.workitemid, alias_p.operationid,
          ? 2???? alias_p.operationkey, alias_p.title, alias_p.sendercn, alias_p.operatedes, alias_p.pendingstate,
          ? 3???? alias_p.parameter, alias_p.createdate, alias_p.deptname, alias_p.completeddate , alias_p.openstate ,
          ? 4???? pd.name, w.processinstanceid
          ? 5???? --,T.ASSETCLASS3? ASSET
          ? 6???? ,f_assetlink(d3.typename) ASSET
          ? 7???? --,eam_db.concatassetname( alias_p.operationkey, alias_p.operationid )? asset
          ? 8???? from WF_Pending alias_p, WF_WorkItem w,
          ? 9???? WF_ProcessDefinition pd, WF_ProcessInstance pi
          ?10???? , tb_asset_dizhiyihao T,dic_app_wfconfig wfc,dic_app_assettype3 d3
          ?11???? where alias_p.ownerid='qinxue'
          ?12???? and alias_p.pendingstate in(0,3,5,7,9,10,11,12)
          ?13???? and (alias_p.deptname='審控部信息處' or alias_p.deptname='' or alias_p.deptname is null)
          ?14???? and w.workitemid = alias_p.workitemid
          ?15???? and pi.processinstanceid = w.processinstanceid
          ?16???? and pi.completeddate is null
          ?17???? and pd.processdefinitionid = w.processdefinitionid
          ?18???? AND??? t.pk_businessid = alias_p.operationid
          ?19??????????? and alias_p.operationkey = wfc.memo_1
          ?20??????????? and wfc.wfconfig_code = t.wfconfig_code
          ?21???? and t.assetclass3 = d3.assettype3_id
          ?22???? group by alias_p.pendingid, alias_p.workitemid, alias_p.operationid,
          ?23???? alias_p.operationkey, alias_p.title, alias_p.sendercn, alias_p.operatedes, alias_p.pendingstate,
          ?24???? alias_p.parameter, alias_p.createdate, alias_p.deptname, alias_p.completeddate , alias_p.openstate ,
          ?25???? pd.name, w.processinstanceid
          ?26???? order by alias_p.createdate desc;

          已選擇30行。


          執行計劃
          ----------------------------------------------------------
          ?? 0????? SELECT STATEMENT Optimizer=CHOOSE (Cost=19 Card=1 Bytes=205)
          ?? 1??? 0?? SORT (GROUP BY) (Cost=19 Card=1 Bytes=205)
          ?? 2??? 1???? NESTED LOOPS (Cost=17 Card=1 Bytes=205)
          ?? 3??? 2?????? HASH JOIN (Cost=16 Card=1 Bytes=191)
          ?? 4??? 3???????? HASH JOIN (Cost=11 Card=1 Bytes=183)
          ?? 5??? 4?????????? NESTED LOOPS (Cost=8 Card=1 Bytes=167)
          ?? 6??? 5???????????? NESTED LOOPS (Cost=7 Card=1 Bytes=139)
          ?? 7??? 6?????????????? NESTED LOOPS (Cost=6 Card=1 Bytes=134)
          ?? 8??? 7???????????????? TABLE ACCESS (FULL) OF 'WF_PENDING' (Cost=5
          ????????? Card=1 Bytes=111)

          ?? 9??? 7???????????????? TABLE ACCESS (BY INDEX ROWID) OF 'WF_WORKITE
          ????????? M' (Cost=1 Card=1 Bytes=23)

          ? 10??? 9?????????????????? INDEX (UNIQUE SCAN) OF 'SYS_C004347' (UNIQ
          ????????? UE)

          ? 11??? 6?????????????? TABLE ACCESS (BY INDEX ROWID) OF 'WF_PROCESSIN
          ????????? STANCE' (Cost=1 Card=1 Bytes=5)

          ? 12?? 11???????????????? INDEX (UNIQUE SCAN) OF 'SYS_C004334' (UNIQUE
          ????????? )

          ? 13??? 5???????????? TABLE ACCESS (BY INDEX ROWID) OF 'WF_PROCESSDEFI
          ????????? NITION' (Cost=1 Card=1 Bytes=28)

          ? 14?? 13?????????????? INDEX (UNIQUE SCAN) OF 'SYS_C004329' (UNIQUE)
          ? 15??? 4?????????? TABLE ACCESS (FULL) OF 'DIC_APP_WFCONFIG' (Cost=2
          ????????? Card=24 Bytes=384)

          ? 16??? 3???????? TABLE ACCESS (FULL) OF 'TB_ASSET_DIZHIYIHAO' (Cost=4
          ?????????? Card=310 Bytes=2480)

          ? 17??? 2?????? TABLE ACCESS (BY INDEX ROWID) OF 'DIC_APP_ASSETTYPE3'
          ????????? (Cost=1 Card=1 Bytes=14)

          ? 18?? 17???????? INDEX (UNIQUE SCAN) OF 'PK_DIC_APP_ASSETTYPE3' (UNIQ
          ????????? UE)

          ?

          ?

          統計信息
          ----------------------------------------------------------
          ????????? 6? recursive calls
          ????????? 0? db block gets
          ??????? 847? consistent gets
          ????????? 0? physical reads
          ????????? 0? redo size
          ?????? 4102? bytes sent via SQL*Net to client
          ??????? 383? bytes received via SQL*Net from client
          ????????? 3? SQL*Net roundtrips to/from client
          ????????? 1? sorts (memory)
          ????????? 0? sorts (disk)

          其中排序由101變為1次
          一致讀降為847。下降非常客觀
          關聯調用僅有6次。
          此sql性能優化非常可觀。至此優化結束:)

          posted @ 2007-09-10 19:35 kebo 閱讀(474) | 評論 (0)編輯 收藏
          數據庫遷移過程中需要目標數據庫和原數據庫結構相同和數據是最新。
          為了保持最新數據和快速切換就不可以利用exp/imp的方式,利用data guard則有平臺的問題。
          在這種情況下,可以利用on prebuilt table選項創建mv。然后同步運行一段時間。一次切換,刪除
          mv,這種情況下可以保持同名的表。mv刪除。達到數據同步,切換的目標。
          posted @ 2007-08-14 15:32 kebo 閱讀(238) | 評論 (0)編輯 收藏
          select z.a,z.b,z.c from (select lag(t.a,2)over(order by t.a) pp_val, lag(t.a,1)over(order by t.a) p_val, t.a, lead(t.a,1)over(order by t.a) n_val, lead(t.a,2)over(order by t.a) nn_val, t.b,t.c from test2 t) z where z.a = '1' and ((z.p_val = '1' and z.pp_val = '1') or (z.p_val = '1' and z.n_val = '1') or (z.n_val = '1' and z.nn_val = '1'));
          posted @ 2007-07-17 16:55 kebo 閱讀(233) | 評論 (0)編輯 收藏
          查詢結果xml化: select dbms_xmlquery.getXML(' select * from test')from dual; 表的歷史記錄:執行:begin dbms_wm.enableversioning('tablename','VIEW_WO_OVERWRITE') 則對這個表的cud操作都會記錄歷史,這個在系統中做歷史再好不過了。 還有終于被tom說明:分析函數原來就是矩陣運算,呵呵,終于知道這類函數的數學原理了,呵呵,真爽,總算知道怎么理解了。 還有寶貝兒遇到新項目,需要很深的會計知識了,還被老板亂說,導致不好工作,希望她不要煩惱,開心工作
          posted @ 2007-07-11 00:15 kebo 閱讀(271) | 評論 (0)編輯 收藏

          配置:server.modules?
          server.modules????????????? = (
          ??????????????????????????????? "mod_rewrite",
          ??????????????????????????????? "mod_redirect",
          ??????????????????????????????? "mod_access",
          ??????????????????????????????? "mod_status",
          ??????????????????????????????? "mod_scgi",
          ??????????????????????????????? "mod_accesslog" )
          配置
          index-file.names??????????? = ( "index.php", "index.html",
          ??????????????????????????????????????????? "index.htm", "default.htm" )
          #### accesslog module
          accesslog.filename????????? = "c:/depot/log/access.log"
          static-file.exclude-extensions = ( ".php", ".pl", ".fcgi",".scgi" )?????? 標紅的需要加上

          ## bind to port (default: 80)
          server.port??????????????? = 8080------------------訪問端口,我設置8080

          ## error-handler for status 404
          server.error-handler-404?? = "/dispatch.scgi"
          -----------------------------------------------
          scgi.server = ("dispatch.scgi" => ((
          "host" => "127.0.0.1",
          "port" => 9999,
          "check-local" => "disable"
          )) )

          scgi.debug=3

          status.status-url = "/server-status"
          status.config-url = "/server-config"

          -------------------------------------
          ## server.virtual-* options
          server.document-root??????? = "c:/depot/public"
          記得這個需要設置到public目錄,不然按默認的rails生成的文檔一些東西訪問不來的
          -----------------------------------------------------------------------------------------------------
          需要注意的是你開發的程序需要放在c盤下,不然找不到config/scgi.yaml這個文件
          然后lighttpd必須裝在c盤下(當前版本下1.4.11)

          posted @ 2007-01-02 21:08 kebo 閱讀(563) | 評論 (0)編輯 收藏
          今天給數據庫執行@spcreate.sql老是出
          SP2-0734:unknown command beginning "spcreate.s..." - rest of line ignored.
          郁悶壞了。經過一番折騰原來是
          solution Description:
          ?=====================
          You need to enter a valid SQL*Plus command.
          In this case, you cannot start svrmgrl from within SQL*Plus,
          you have to start svrmgrl from the command prompt.
          This error will also occur when trying to execute a
          the @ symbol is mapped to the key 'Kill' from the user's keyboard.
          The way to find out the current keyboard mapping in a unix environment is using the command 'stty -a'.
          The way to correct problem is to map 'Kill' to some other keyboard symbol.
          The command example would be 'stty kill ^U'.
          Having remapped the key you would then log into SQL*Plus and execute script.
          ?-------------------------------紀念一下
          如果出現空行報錯的話 記得執行:
          SET SQLBLANKLINES ON
          posted @ 2006-12-27 22:24 kebo 閱讀(525) | 評論 (0)編輯 收藏
          呵呵,最近吵架比較多,我們項目和另公司合作,經常出現兩家吵架的事件,小弟不信參與其中。通過具體實踐,發現我現在很容易發現別人說話的漏洞。然后常常質問對方大哥無法可說,呵呵,痛快。 我想這是 我比較最近比較喜歡高手們爭論話題的帖子,建議想提高吵架水平的人多學學(別用在mm身上^^)
          posted @ 2006-11-01 04:11 kebo 閱讀(342) | 評論 (0)編輯 收藏
          ? 今天聽了下oracle講座,一個感受,以后不敢操作數據庫了,發現對大多數數據庫命令產生的后果和影響都不是很清楚。想起以前切換雙機

          的時候也出現eygle說的問題,然來真的對數據庫基礎知識預備不足啊。感覺以前真是可以稱為“虎膽”哦。難怪老幕以前佩服我!!!卡卡卡。

          恩,感覺oracle入門現在都夠不上,不敢再給別人解決問題:)免得惹笑話。梳理了一下,估計也就對sql,集合的理解熟悉點,有點把我哦。低

          調,低調......學習學習......
          posted @ 2006-10-03 01:43 kebo 閱讀(484) | 評論 (0)編輯 收藏
          一個比較好的緩存中間件memcached。可以用做系統的各種緩存。支持分布式。使用方便。網上有很多介紹。多是linux&unix版。現在也有window32版本了。方便實現SNA架構。在網站架構上用處多多。
          http://jehiah.com/projects/memcached-win32/
          啟動,使用都是比較方便。可以到http://www.danga.com/memcached/下各種客戶api。下載的client有使用test。一看就明白。
          呵呵,真實好東西。

          -----------------------

          呵呵,發現plone中也用它做緩存了.

          --------------------------
          前幾天使用了一下,發現在win下面容易出現占用cpu 100%的情況,不知道什么原因,有誰知道?沒有別的什么操作,insert/get操作而已.

          查找中.......

          奇怪,plone中為什么不出現!!!!

          posted @ 2006-08-11 00:03 kebo 閱讀(545) | 評論 (1)編輯 收藏
          早上9點的飛機,昨天晚上電話本來有很多話想說。最后竟木木的什么也沒說。
          想象著空中的佳佳.......
          想象著她忙忙碌碌的樣子......
          小豬開始了新的生活了......
          不知道什么時候才可以再見到......
          晚上等電話了......盼望著她盡快安定下來......
          希望她在異國他鄉平平安安,健健康康的.
          posted @ 2006-07-30 16:52 kebo 閱讀(314) | 評論 (0)編輯 收藏
          佳佳要飛的日子越來越近了,我已經感到了一絲絲殘酷了。一直一直麻痹自己。
          posted @ 2006-07-19 10:29 kebo 閱讀(303) | 評論 (0)編輯 收藏
          劫財劫色死了,哎,可憐的兩個小家伙,悲哀中!!!!!!!!
          都是你的主人沒有好好照顧你,投胎時別在做龜了
          posted @ 2006-07-14 23:50 kebo 閱讀(233) | 評論 (0)編輯 收藏
          在實際的軟件開發過程中,我們常常可以看到這樣的情形:一方面是開發人員指責需求人員不懂用戶的真正的需求,講解的需求和最后客戶的要求想去甚遠或指責需求只是客戶的傳聲筒,拿到的需求不整理一下,就丟給開發人員開始做。另一方面是需求罵開發人員笨,對需求一點不理解,只懂機械的做。
          這樣的情況,常常導致系統不停的修改,bug不斷。客戶,需求,開發都筋疲力盡,然后就是項目延期,直到死亡。

          ?????? 這樣的情況,相信每個做企業系統的開發人員都遇到過,一提起這樣的問題,大家只有擺腦袋,喃喃到“簡直就是惡夢,太難了”
          ^_^(希望不要勾起你痛苦的回憶)

          ???? 其實出現這樣的情況,大部分是應為需求人員和開發人員對問題的思考模式不同導致的。在業務語言和業務規則向計算機語言和系統模型轉換之間有一個的過程。這個過程必須有一個銜接的人和模式來做這件事情。
          ???? 這個角色需要精通業務概念和系統實現方式。然后運用分析模式方式把業務概念轉換為系統模型概念。需求人員理解業務總是自覺不自覺的把一些他們認為是常識的思維放進去,但是這部分只是不會出現在需求文檔中。這就需要分析人員不斷的和他需求聊天,不但的詢問挖掘出來。然后寫入概要設計和詳細涉及文檔中。
          還有需求人員往往在寫程序需要處理的邏輯的時候會不自覺的融入人類的思考模式,在其中加入一些智能判斷,但是這部分邏輯往往用計算機實現比較困難。這就需要分析人員的洞察能力,找到客戶的真正需求,然后轉換方式來實現。

          ????? 例如:有這樣一個需求是分析業務數據的。表中有27列,其中a,b,c,d,e,g,p,q,y,z為判斷過程中所涉及到的數據項,各項之間的關系為:b列中的傳輸系統速決定z列中的最大時隙編號。如2。5G系統對應的最大時隙編號為16或8(保護)。10g系統對應的最大時隙編號為64或32(保護)。
          ????? D列為與C列中站點相領的前向站點,e列為與c列中站點相領的后向站點。
          ????? G列與p列或q列為--對應關系,即唯一的一個端口對應當前傳輸系統的一個時隙。
          ???? ?p列和q列在一行中不同時出現。即同時只有前項時隙或后項時隙,兩者不同時存在。
          ????? y列為版本號,1代表設計版,2代表工程版。當g列中相同的兩個端口對應的z列不同的時隙時,以Y列為2的為準。

          ?
          (一下為客戶平時所用的人工分析方式)
          分析過程:
          1)首先根據系統名稱中的2。5G可以判斷出Z列的最大編號為16或8,對z列進行觀察后得出最大編號為8。即存在8個時隙,編號分別為1~8.
          2)? 將c列為“杭環城北路”站點下所有z列的數據觀察后可看出z列無5,6兩個時隙,于是初步判斷時隙在該站點為穿通。
          3)c列為“杭環城北路”所對應的D列前向站點為“衢州網通”。在z列中查找所有c列為“衢州網通”所對應的時隙,發現5,6兩個時隙編號,且p,q兩列中僅q列有數據,說明該時隙為后向時隙。可得出5,6兩個時隙的起始站點為“衢州網通”。因該時隙對應的Y列均有1,2兩個數值,根據“各項間關系”,僅取Y列數值為2的數據為有效數據。
          4)c列為“杭環城北路”所對應的e列后向站點為“寧波網通”。在z列中查找所有c列為“寧波網通”所對應的時隙,發現5,6兩個時隙編號。且p,q兩列僅p列有數據,說明該時隙為前向時隙,可得出5,6兩個時隙的終止站點為“寧波網通”。因該時隙對應的Y列均有1,2兩個數據,根據各項間干系,取Y列為2的數據為有效數據。
          綜合判斷1~4不的判斷過程,可以得出結論:編號為5,6的兩個時隙以“衢州網通”為起點,途徑“杭環城北路”以“寧波網通”為終點


          可以看到這個分析過程很不利于計算機話
          (一下為我的分析方式)



          ------推薦的方式



          -------其他


          (未完待續........)
          posted @ 2006-07-01 11:58 kebo 閱讀(402) | 評論 (0)編輯 收藏
               與人為善,種善因,得善果.
          懂得說謝謝,會說謝謝,對人際關系很重要。
          今天碰到一個剛畢業的小孩,給他教東西的時候,竟沒有聽到一句感謝的話.
          郁悶噢
          posted @ 2006-06-23 23:52 kebo 閱讀(318) | 評論 (0)編輯 收藏
               昨天晚上做了一個奇怪的夢,夢到被一條蛇咬了一下。清楚的記得是手指被咬的,竟痛醒了,醒了還感到手指隱隱做痛

          然后今天八卦的查了一下,周公解夢如下:

          蛇化龍得貴人助, 蛇咬人主得大財, 蛇多者主陰司事, 鶴上天主小口災, 鸚鵡喚人主口舌, 燕子至有造客來, 

          呵呵,難道是真的?

          然后今天很奇怪,一把黃楊木梳也折斷了.......可惜了,跟我兩年了。

          posted @ 2006-06-19 19:42 kebo 閱讀(290) | 評論 (0)編輯 收藏

          xxx購物超市折扣規則描述:
           1.任何顧客的購物總價大于1000元則享受9折優惠
           2.vip顧客的時候無論購物總價是多少享受7折優惠
           3.普通顧客沒有特別政策,另有規定的除外
           4.白金顧客享受8.5優惠,無論購物總價多少。
           5.黃金顧客享受9折優惠無論購物總價多少。
           6.任何顧客所夠商品中包含tv的時候,優惠后再優惠9.5折
          這個user case 是自己想的,不是很復雜

          對應的規則文件

          #created on: 2006-6-10
          #created by: kebo
          package com.sample

          import com.sample.Person;
          import com.sample.ShopCat;
          import com.sample.Product;
          import com.sample.Helper;


          rule "PRICE_DISCOUT"
           salience 2
           no-loop true
           when
            p:Person(c:cat->(c.getTotalPrice()>1000),discout==1)     
           then
            p.setDiscout(0.9);
            modify(p); 
          end

          rule "VIP"
           salience 3
           no-loop true
           when
            p:Person(type==Person.VIP,discout==1)     
           then
            p.setDiscout(0.7);
            modify(p); 
          end

          rule "COMMON"
           salience 3
           no-loop true
           when
            p:Person(type==Person.COMMON,discout==1)     
           then
            p.setDiscout(1);
            modify(p);
          end

          rule "PLATINA"
           salience 3
           no-loop true
           when
            p:Person(type==Person.PLATINA,discout==1)     
           then
            p.setDiscout(0.85); 
            modify(p);
          end

          rule "GOLD"
           salience 3
           no-loop true
           when
            p:Person(type==Person.GOLD,discout==1)     
           then  
            p.setDiscout(0.9); 
            modify(p);
          end

          rule "CONTAIN TV"
           salience 1
           no-loop true
           when
            p:Person(c:cat->(Helper.isContainType(c.getProducts(),Product.TV)))     
           then
            p.setDiscout(0.95 * p.getDiscout());
            modify(p);
          end

          解決rule的沖突還是比較麻煩的。

          為什么blogjava沒有code著色功能呢?代碼貼上去一點都不好看,唉!

           

           

          posted @ 2006-06-13 01:19 kebo 閱讀(2042) | 評論 (0)編輯 收藏
               今天去客戶處開會,讓我看到了政治。
          人與人的關系真實復雜啊!真的是看到因一句話不小心而引火燒身例子,本來那個同事是可以安枕無優的,最后怎一個
          慘字了得。記住,以為戒。

               還有一點感受,做信息系統,最重要的是什么?
          功能?模塊?速度?是否漂亮?是否有好的架構?
          其實這些都是次要的,真正重要的是如何保證“信息的正確性”
          數據錯誤,數據表達的不完整,數據不全。這些東西決定了一個
          系統的價值。如果一個系統沒有做到這點,那么這個系統就
          毫無價值。依據這些信息做的決策會死人的。
          沒有99%,只有100%
          posted @ 2006-06-08 22:41 kebo 閱讀(240) | 評論 (0)編輯 收藏
                 '"下輩子如果我還記得你"馬郁詮釋的非常棒
          淡淡的憂愁,淡淡的思念還有對往日情人的深深懷念,
          對昔日山盟海誓的追憶.和不能和戀人在一起的絲絲痛楚..
          很好聽
          這輩子你是否還記得我?
          posted @ 2006-06-07 14:21 kebo 閱讀(321) | 評論 (1)編輯 收藏
          今天的面試經歷,,瞞搞笑的..
          聊到最后,,我聽著有些納悶,,然后問他招聘什么職位..答'"'測試工程師"
          暈倒,,我告他'"'我做開發的"
          答'"'我們測試也開發,,也是開發工程師"
          我說'''對不起,,我對專門做測試沒興趣"
          然后散

          郁悶..浪費時間

          前臺mm不錯..很性感的



                下午再面一家,問了一個問題,一門動態語言,沒有調試器,現在程序出錯了,
          但是沒有給出任何錯誤信息,
          或者錯誤信息就提示錯誤,代碼
          行數有3k多,現在你怎么快速的定位錯誤行?
          靠,這個有什么辦法?
          我答'"'先預測錯誤的問題,然后輸出調試"
          告我'"'不是,,讓我回去想想"
          然后說這個問題沒有答出來,不能給我期望的工資(ft,,難道要答出所有的問題嗎?)
          我說'"'不會吧,,面試的人能答出所有的問題嗎?"
          告我'"'這個問題很簡單"
          切!!,難道真的簡單?
          posted @ 2006-06-06 15:46 kebo 閱讀(268) | 評論 (0)編輯 收藏

          <2006年6月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章檔案

          相冊

          收藏夾

          朋友

          搜索

          •  

          積分與排名

          • 積分 - 23213
          • 排名 - 1598

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 平定县| 巴中市| 安化县| 永兴县| 卢氏县| 桃园县| 清河县| 达州市| 拜城县| 安岳县| 屏山县| 淮南市| 柏乡县| 麟游县| 栾川县| 九龙城区| 福州市| 定远县| 老河口市| 虞城县| 阿拉尔市| 麻城市| 宜州市| 铁力市| 新竹县| 松江区| 开封县| 江都市| 高安市| 定远县| 会昌县| 方山县| 云和县| 涞水县| 平罗县| 高密市| 玉屏| 得荣县| 万载县| 偏关县| 海晏县|