SQLs erver migration performance issue

We are performing migration from oracle to MSSQL server 2005 (Windows 2003/SAP 4.6D).Our target system configuration is like below:
->OS - Windows 2003 x64
->DB - MSSQL server 2005 SP4
->SAP - 4.6 D kernel
->CPU - 4 processors (2.67ghz each)
->RAM - 16 GB
->source system DB size - around 1 TB and package splitting was implemented.
While importing the export dump that came from source system, we are facing load performance issue's.
1) We have started 10 parallel processes and after import is started, CPU is getting 95% to 99% utilized and when we check SQL server studio-> Activity monitor we  found below information:
-There were around 20 processes are in status sleeping
-Only one or two system processes are running with commands - INSERT,SELECT INTO commands ( column)
-At any point of time only two processes are running and CPU utilization is hitting high.
-Import is very slow and its taking 35 hours to complete
We have followed few SAP notes(1054852,1241751 e.tc..) and below are the settings for SQL server:
-Minimum server memory - 5 GB
- Maximum server memory - 5 GB
- index creation memory - 0
- Maximum memory per query - 1024 kb
- Maximum degree of parellelism - 1
- Parallellism locks - 0
- Cost threshold of parellism - 5
- Enabled trace flags - 610,620,1117,1211,3917
- Windows environment variable BCP_BATCH_SIZE = 10000
- SQL log file size - 100 GB
- tempdb size - 20 GB
2) When we tried another test import after tuning parameters (Maximum degree of parellelism to 3) and increasing r3load parallel processes to 20, we found  of inserts
are overflowing in process list and blocking other waiting processes and putting them in suspended mode.CPU utilization is at 80%
Are there any SQL server parameters need to be tuned to fix this import load time issue in both scenarios? Are there any  best practises for migrating to SQL server?
Thanks..

> 1) We have started 10 parallel processes and after import is started, CPU is getting 95% to 99% utilized and when we check SQL server studio-> Activity monitor we  found below information:
What processes is using the CPU? The SQL Server itself or others? (see task manager)
> -Minimum server memory - 5 GB
> - Maximum server memory - 5 GB
For the time of the migration itself I'd give the database more memory (10 GB or more) and reconfigure later when the import is done.
What parameters do you use for the R3load? I'd recommend
-loadprocedure fast -merge_bck -c 10000
and also set
BCP_LOB=1 in the environment.
Markus

Similar Messages

  • Oracle 11g Migration performance issue

    Hello,
    There a performance issue with Migration from Oracle 10g(10.2.0.5) to Oracle 11g(11.2.0.2).
    Its very simple statement hanging for more than a day and later found that query plan is very very bad. Example of the query is given below:
    INSERT INTO TABLE_XYZ
    SELECT F1,F2,F3
    FROM TABLE_AB, TABLE_BC
    WHERE F1=F4;
    While looking at cost in Explain plan :
    on 10g --> 62567
    0n 11g --> 9879652356776
    Strange thing is that
    Scenario 1: if I issue just query as shown below, will display rows immediately :
    SELECT F1,F2,F3
    FROM TABLE_AB, TABLE_BC
    WHERE F1=F4;
    Scenario 2: If I create a table as shown below, will work correctly.
    CREATE TABLE TABLE_XYZ AS
    SELECT F1,F2,F3
    FROM TABLE_AB, TABLE_BC
    WHERE F1=F4;
    What could be the issue here with INSERT INTO <TAB> SELECT <COL> FROM <TAB1>?

    Table:
    CREATE TABLE AVN_WRK_F_RENEWAL_TRANS_T
    "PKSRCSYSTEMID" NUMBER(4,0) NOT NULL ENABLE,
    "PKCOMPANYCODE" VARCHAR2(8 CHAR) NOT NULL ENABLE,
    "PKBRANCHCODE" VARCHAR2(8 CHAR) NOT NULL ENABLE,
    "PKLINEOFBUSINESS" NUMBER(4,0) NOT NULL ENABLE,
    "PKPRODUCINGOFFICELIST" VARCHAR2(2 CHAR) NOT NULL ENABLE,
    "PKPRODUCINGOFFICE" VARCHAR2(8 CHAR) NOT NULL ENABLE,
    "PKEXPIRYYR" NUMBER(4,0) NOT NULL ENABLE,
    "PKEXPIRYMTH" NUMBER(2,0) NOT NULL ENABLE,
    "CURRENTEXPIRYCOUNT" NUMBER,
    "CURRENTRENEWEDCOUNT" NUMBER,
    "PREVIOUSEXPIRYCOUNT" NUMBER,
    "PREVIOUSRENEWEDCOUNT" NUMBER
    SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
    TABLESPACE "XYZ" ;
    Explain Plan(With Insert Statement and Query):_
    INSERT STATEMENT, GOAL = ALL_ROWS               Cost=9110025395866     Cardinality=78120     Bytes=11952360
    LOAD TABLE CONVENTIONAL     Object owner=ODS     Object name=AVN_WRK_F_RENEWAL_TRANS               
    NESTED LOOPS OUTER               Cost=9110025395866     Cardinality=78120     Bytes=11952360
    TABLE ACCESS FULL     Object owner=ODS     Object name=AVN_WRK_F_RENEWAL_TRANS_1ST     Cost=115     Cardinality=78120     Bytes=2499840
    VIEW PUSHED PREDICATE     Object owner=ODS          Cost=116615788     Cardinality=1     Bytes=121
    SORT GROUP BY               Cost=116615788     Cardinality=3594     Bytes=406122
    VIEW     Object owner=SYS     Object name=VW_DAG_1     Cost=116615787     Cardinality=20168     Bytes=2278984
    SORT GROUP BY               Cost=116615787     Cardinality=20168     Bytes=4073936
    NESTED LOOPS OUTER               Cost=116614896     Cardinality=20168     Bytes=4073936
    VIEW     Object owner=SYS          Cost=5722     Cardinality=20168     Bytes=2157976
    NESTED LOOPS               Cost=5722     Cardinality=20168     Bytes=2097472
    HASH JOIN               Cost=924     Cardinality=1199     Bytes=100716
    NESTED LOOPS                         
    NESTED LOOPS               Cost=181     Cardinality=1199     Bytes=80333
    TABLE ACCESS BY INDEX ROWID     Object owner=ODS     Object name=INWARDSPOLICYDETAILS     Cost=159     Cardinality=1199     Bytes=39567
    INDEX RANGE SCAN     Object owner=ODS     Object name=IX_INWPOLDTLS_SYSCOMPANYBRANCH     Cost=7     Cardinality=1199     
    INDEX UNIQUE SCAN     Object owner=ODS     Object name=PK_AVN_D_MASTERPOLICYDETAILS     Cost=0     Cardinality=1     
    TABLE ACCESS BY INDEX ROWID     Object owner=ODS     Object name=AVN_D_MASTERPOLICYDETAILS     Cost=1     Cardinality=1     Bytes=34
    TABLE ACCESS FULL     Object owner=ODS     Object name=INWARDSPOLICYLOBMAPPING     Cost=741     Cardinality=288498     Bytes=4904466
    VIEW PUSHED PREDICATE     Object owner=ODS          Cost=4     Cardinality=1     Bytes=20
    FILTER                         
    SORT AGGREGATE                    Cardinality=1     Bytes=21
    TABLE ACCESS BY GLOBAL INDEX ROWID     Object owner=ODS     Object name=AVN_F_TRANSACTIONS     Cost=4     Cardinality=1     Bytes=21
    INDEX RANGE SCAN     Object owner=ODS     Object name=PK_AVN_F_TRANSACTIONS     Cost=3     Cardinality=1     
    VIEW PUSHED PREDICATE     Object owner=ODS          Cost=5782     Cardinality=1     Bytes=95
    SORT GROUP BY               Cost=5782     Cardinality=2485     Bytes=216195
    VIEW     Object owner=SYS     Object name=VW_DAG_0     Cost=5781     Cardinality=2485     Bytes=216195
    SORT GROUP BY               Cost=5781     Cardinality=2485     Bytes=278320
    HASH JOIN               Cost=5780     Cardinality=2485     Bytes=278320
    VIEW     Object owner=SYS     Object name=VW_GBC_15     Cost=925     Cardinality=1199     Bytes=73139
    SORT GROUP BY               Cost=925     Cardinality=1199     Bytes=100716
    HASH JOIN               Cost=924     Cardinality=1199     Bytes=100716
    NESTED LOOPS                         
    NESTED LOOPS               Cost=181     Cardinality=1199     Bytes=80333
    TABLE ACCESS BY INDEX ROWID     Object owner=ODS     Object name=INWARDSPOLICYDETAILS     Cost=159     Cardinality=1199     Bytes=39567
    INDEX RANGE SCAN     Object owner=ODS     Object name=IX_INWPOLDTLS_SYSCOMPANYBRANCH     Cost=7     Cardinality=1199     
    INDEX UNIQUE SCAN     Object owner=ODS     Object name=PK_AVN_D_MASTERPOLICYDETAILS     Cost=0     Cardinality=1     
    TABLE ACCESS BY INDEX ROWID     Object owner=ODS     Object name=AVN_D_MASTERPOLICYDETAILS     Cost=1     Cardinality=1     Bytes=34
    TABLE ACCESS FULL     Object owner=ODS     Object name=INWARDSPOLICYLOBMAPPING     Cost=741     Cardinality=288498     Bytes=4904466
    VIEW     Object owner=SYS     Object name=VW_GBF_16     Cost=4854     Cardinality=75507     Bytes=3850857
    SORT GROUP BY               Cost=4854     Cardinality=75507     Bytes=2340717
    VIEW     Object owner=ODS          Cost=4207     Cardinality=75507     Bytes=2340717
    SORT GROUP BY               Cost=4207     Cardinality=75507     Bytes=1585647
    PARTITION HASH ALL               Cost=3713     Cardinality=75936     Bytes=1594656
    TABLE ACCESS FULL     Object owner=ODS     Object name=AVN_F_TRANSACTIONS     Cost=3713     Cardinality=75936     Bytes=1594656
    Explain Plan(Only Query):_
    SELECT STATEMENT, GOAL = ALL_ROWS               Cost=62783     Cardinality=89964     Bytes=17632944
    HASH JOIN OUTER               Cost=62783     Cardinality=89964     Bytes=17632944
    TABLE ACCESS FULL     Object owner=ODS     Object name=AVN_WRK_F_RENEWAL_TRANS_1ST     Cost=138     Cardinality=89964     Bytes=2878848
    VIEW     Object owner=ODS          Cost=60556     Cardinality=227882     Bytes=37372648
    HASH GROUP BY               Cost=60556     Cardinality=227882     Bytes=26434312
    VIEW     Object owner=SYS     Object name=VW_DAG_1     Cost=54600     Cardinality=227882     Bytes=26434312
    HASH GROUP BY               Cost=54600     Cardinality=227882     Bytes=36005356
    HASH JOIN OUTER               Cost=46664     Cardinality=227882     Bytes=36005356
    VIEW     Object owner=SYS          Cost=18270     Cardinality=227882     Bytes=16635386
    HASH JOIN               Cost=18270     Cardinality=227882     Bytes=32587126
    HASH JOIN               Cost=12147     Cardinality=34667     Bytes=2912028
    HASH JOIN               Cost=10076     Cardinality=34667     Bytes=2322689
    TABLE ACCESS FULL     Object owner=ODS     Object name=AVN_D_MASTERPOLICYDETAILS     Cost=137     Cardinality=34667     Bytes=1178678
    TABLE ACCESS FULL     Object owner=ODS     Object name=INWARDSPOLICYDETAILS     Cost=9934     Cardinality=820724     Bytes=27083892
    TABLE ACCESS FULL     Object owner=ODS     Object name=INWARDSPOLICYLOBMAPPING     Cost=741     Cardinality=866377     Bytes=14728409
    VIEW     Object owner=ODS          Cost=5195     Cardinality=227882     Bytes=13445038
    HASH GROUP BY               Cost=5195     Cardinality=227882     Bytes=4785522
    PARTITION HASH ALL               Cost=3717     Cardinality=227882     Bytes=4785522
    TABLE ACCESS FULL     Object owner=ODS     Object name=AVN_F_TRANSACTIONS     Cost=3717     Cardinality=227882     Bytes=4785522
    VIEW     Object owner=ODS          Cost=26427     Cardinality=227882     Bytes=19369970
    HASH GROUP BY               Cost=26427     Cardinality=227882     Bytes=18686324
    VIEW     Object owner=SYS     Object name=VW_DAG_0     Cost=26427     Cardinality=227882     Bytes=18686324
    HASH GROUP BY               Cost=26427     Cardinality=227882     Bytes=25294902
    HASH JOIN               Cost=20687     Cardinality=227882     Bytes=25294902
    VIEW     Object owner=SYS     Object name=VW_GBC_15     Cost=12826     Cardinality=34667     Bytes=2080020
    HASH GROUP BY               Cost=12826     Cardinality=34667     Bytes=2912028
    HASH JOIN               Cost=12147     Cardinality=34667     Bytes=2912028
    HASH JOIN               Cost=10076     Cardinality=34667     Bytes=2322689
    TABLE ACCESS FULL     Object owner=ODS     Object name=AVN_D_MASTERPOLICYDETAILS     Cost=137     Cardinality=34667     Bytes=1178678
    TABLE ACCESS FULL     Object owner=ODS     Object name=INWARDSPOLICYDETAILS     Cost=9934     Cardinality=820724     Bytes=27083892
    TABLE ACCESS FULL     Object owner=ODS     Object name=INWARDSPOLICYLOBMAPPING     Cost=741     Cardinality=866377     Bytes=14728409
    VIEW     Object owner=SYS     Object name=VW_GBF_16     Cost=7059     Cardinality=227882     Bytes=11621982
    HASH GROUP BY               Cost=7059     Cardinality=227882     Bytes=6836460
    VIEW     Object owner=ODS          Cost=5195     Cardinality=227882     Bytes=6836460
    HASH GROUP BY               Cost=5195     Cardinality=227882     Bytes=4785522
    PARTITION HASH ALL               Cost=3717     Cardinality=227882     Bytes=4785522
    TABLE ACCESS FULL     Object owner=ODS     Object name=AVN_F_TRANSACTIONS     Cost=3717     Cardinality=227882     Bytes=4785522

  • SQL Query Having performance issues

    I need help on rewriting this query, I am having performance issues with the way it is now. I create a temporary table and query against it. Any help will be appreciated. Thanks, Antonio
    Here it is:
    create global temporary table pr_php_elig_tmp
    on commit preserve rows as
    SELECT UNIQUE A.SAK_PROV, A.CDE_SERVICE_LOC, a.sak_short
    FROM T_PR_PHP_ELIG A,
    T_PR_TYPE C
    WHERE C.SAK_PROV = A.SAK_PROV
    AND C.CDE_SERVICE_LOC = A.CDE_SERVICE_LOC
    AND C.CDE_PROV_TYPE not in ('01', '03', '08', '24', '27', '31')
    AND A.SAK_PROV_PGM not in (11, 13)
    AND A.DTE_END >= :il_current_date
    AND A.DTE_EFFECTIVE <= :il_prev_18_months
    AND NOT EXISTS (
    SELECT 'X'
    FROM T_PR_GRP_MBR T
    WHERE T.SAK_PROV = A.SAK_PROV
    AND T.CDE_SVC_LOC_MBR = A.CDE_SERVICE_LOC)
    AND NOT EXISTS (
    select a.sak_prov, a.cde_service_loc
    from t_pmp_svc_loc d
    where a.sak_prov = d.sak_prov
    and a.cde_service_loc = d.cde_service_loc
    and d.dte_end >= :il_current_date)
    ORDER BY A.SAK_PROV, A.CDE_SERVICE_LOC;
    select * from pr_php_elig_tmp
    minus
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_dntl_dtl temp01
                   WHERE temp01.sak_prov_perf = a.sak_prov
                   and temp01.cde_svc_loc_perf = a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
                   HAVING MAX(temp01.DTE_FIRST_SVC) >= :il_prev_18_months
                   OR NVL(MAX(temp01.DTE_FIRST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_dntl_hdr temp02
                   WHERE ( (temp02.prov_billing     = a.sak_prov
                   and temp02.cde_service_loc = a.cde_service_loc)
                   OR     (temp02.sak_prov_perf     = a.sak_prov
                   and temp02.cde_perf_svc_loc = a.cde_service_loc)
                   OR     (temp02.sak_prov_referring = a.sak_prov
                   and temp02.cde_svc_loc_ref_1 = a.cde_service_loc)
                   OR     (temp02.sak_prov_referring_2 = a.sak_prov
                   and temp02.cde_svc_loc_ref_2 = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
                   HAVING MAX(temp02.DTE_FINAL)     >= :il_prev_18_months
                   OR NVL(MAX(temp02.DTE_FINAL),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phrm_hdr temp03
                   WHERE ( (temp03.prov_billing     = a.sak_prov and
                        temp03.cde_service_loc = a.cde_service_loc)
                   OR     (temp03.sak_prov_rendering = a.sak_prov and
                        temp03.cde_svc_loc_rend = a.cde_service_loc)
                   OR     (temp03.sak_presc_prov = a.sak_prov and
                        temp03.cde_svc_loc_presc = a.cde_service_loc)
                   OR     temp03.id_prov_prescrb = to_char(a.sak_prov) || a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
                   HAVING     MAX(temp03.DTE_FINAL) >= :il_prev_18_months
                   OR     NVL(MAX(temp03.DTE_FINAL),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phys_dtl temp04
              WHERE ( (temp04.sak_prov_perf     = a.sak_prov
                   and     temp04.cde_svc_loc_rend = a.cde_service_loc)
                   OR (temp04.sak_prov_referring = a.sak_prov
                   and     temp04.cde_svc_loc_ref_1 = a.cde_service_loc)
                   OR (temp04.sak_prov_referring_2 = a.sak_prov
                   and     temp04.cde_svc_loc_ref_2 = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING     MAX(temp04.DTE_LAST_SVC)     >= :il_prev_18_months
                   OR     NVL(MAX(temp04.DTE_LAST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phys_hdr temp05
              WHERE ( (temp05.prov_billing     = a.sak_prov
                   and     temp05.cde_service_loc     = a.cde_service_loc)
                   OR (temp05.sak_prov_perf     = a.sak_prov
                   and     temp05.cde_perf_svc_loc = a.cde_service_loc)
                   OR (temp05.sak_prov_referring = a.sak_prov
                   and     temp05.cde_svc_loc_ref_1 = a.cde_service_loc)
                   OR (temp05.sak_prov_referring_2 = a.sak_prov
                   and     temp05.cde_svc_loc_ref_2 = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING     MAX(temp05.DTE_FINAL) >= :il_prev_18_months
                   OR     NVL(MAX(temp05.DTE_FINAL),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_ub92_dtl temp06
              WHERE ( (temp06.sak_pr_other     = a.sak_prov
                   and     temp06.cde_scv_loc_other = a.cde_service_loc)
                   OR (temp06.sak_pr_other_2     = a.sak_prov
                   and     temp06.cde_svc_loc_other_2 = a.cde_service_loc)
                   OR (temp06.sak_pr_attend     = a.sak_prov
                   and     temp06.cde_svc_loc_attend = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING     MAX(temp06.DTE_LAST_SVC)     >= :il_prev_18_months
                   OR     NVL(MAX(temp06.DTE_LAST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_ub92_hdr temp07
              WHERE ( (temp07.prov_billing     = a.sak_prov
                   and     temp07.cde_service_loc     = a.cde_service_loc)
              OR (temp07.sak_pr_facility     = a.sak_prov
                   and     temp07.cde_svc_loc_fa     = a.cde_service_loc)
              OR (temp07.sak_pr_other     = a.sak_prov
                   and     temp07.cde_svc_loc_other = a.cde_service_loc)
              OR (temp07.sak_pr_other_2     = a.sak_prov
                   and     temp07.cde_svc_loc_other_2 = a.cde_service_loc)
              OR (temp07.sak_pr_attend     = a.sak_prov
                   and     temp07.cde_svc_loc_attend = a.cde_service_loc)
              OR     temp07.id_prov_attend     = to_char(a.sak_prov) || a.cde_service_loc
              OR     temp07.id_prov_other     = to_char(a.sak_prov) || a.cde_service_loc
              OR     temp07.id_prov_other_2     = to_char(a.sak_prov) || a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp07.DTE_FINAL)     >= :il_prev_18_months
                   OR     NVL(MAX(temp07.DTE_FINAL),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_dntl_dtl temp08
              WHERE temp08.sak_prov_perf     = a.sak_prov
                   and temp08.cde_svc_loc_perf     = a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp08.DTE_FIRST_SVC) >= :il_prev_18_months
                   OR     NVL(MAX(temp08.DTE_FIRST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_dntl_hdr     temp09
              WHERE ( (temp09.prov_billing     = a.sak_prov
                   and     temp09.cde_service_loc     = a.cde_service_loc)
              OR (temp09.sak_prov_perf     = a.sak_prov
                   and     temp09.cde_perf_svc_loc = a.cde_service_loc)
              OR (temp09.sak_prov_referring = a.sak_prov
                   and     temp09.cde_svc_loc_ref_1 = a.cde_service_loc)
              OR (temp09.sak_prov_referring_2 = a.sak_prov
                   and     temp09.cde_svc_loc_ref_2 = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp09.DTE_FINAL)     >= :il_prev_18_months
                   OR     NVL(MAX(temp09.DTE_FINAL),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_pharm_hdr temp10
              WHERE ( (temp10.prov_billing     = a.sak_prov
                   and     temp10.cde_service_loc     = a.cde_service_loc)
              OR (temp10.sak_prov_rend     = a.sak_prov
                   and     temp10.cde_svc_loc_rend = a.cde_service_loc)
              OR (temp10.sak_presc_prov     = a.sak_prov
                   and     temp10.cde_svc_loc_presc = a.cde_service_loc)
              OR     temp10.id_prov_prescrb     = to_char(a.sak_prov) || a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp10.DTE_FINAL)     >= :il_prev_18_months
                   OR     NVL(MAX(temp10.DTE_FINAL),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_phys_dtl temp11
              WHERE ( (temp11.sak_prov_perf     = a.sak_prov
                   and     temp11.cde_svc_loc_rend = a.cde_service_loc)
              OR (temp11.sak_prov_referring = a.sak_prov
                   and     temp11.cde_svc_loc_ref_1 = a.cde_service_loc)
              OR (temp11.sak_prov_referring_2 = a.sak_prov
                   and     temp11.cde_svc_loc_ref_2 = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp11.DTE_LAST_SVC)     >= :il_prev_18_months
                   OR     NVL(MAX(temp11.DTE_LAST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_phys_hdr     temp12
              WHERE ( (temp12.prov_billing     = a.sak_prov
                   and     temp12.cde_service_loc     = a.cde_service_loc)
              OR (temp12.sak_prov_perf     = a.sak_prov
                   and     temp12.cde_perf_svc_loc = a.cde_service_loc)
              OR (temp12.sak_prov_referring = a.sak_prov
                   and     temp12.cde_svc_loc_ref_1 = a.cde_service_loc)
              OR (temp12.sak_prov_referring_2 = a.sak_prov
                   and     temp12.cde_svc_loc_ref_2 = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp12.DTE_FINAL)     >= :il_prev_18_months
                   OR     NVL(MAX(temp12.DTE_FINAL),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_ub92_dtl temp13
              WHERE ( (temp13.sak_pr_other     = a.sak_prov
                   and     temp13.cde_scv_loc_other = a.cde_service_loc)
                   OR (temp13.sak_pr_other_2     = a.sak_prov
                   and     temp13.cde_svc_loc_other_2 = a.cde_service_loc)
                   OR (temp13.sak_pr_attend     = a.sak_prov
                   and     temp13.cde_svc_loc_attend = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING     MAX(temp13.DTE_LAST_SVC)     >= :il_prev_18_months
                   OR     NVL(MAX(temp13.DTE_LAST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_ub92_hdr     temp14
              WHERE ( (temp14.prov_billing     = a.sak_prov
                   and     temp14.cde_service_loc     = a.cde_service_loc)
              OR (temp14.sak_pr_facility     = a.sak_prov
                   and     temp14.cde_svc_loc_fa     = a.cde_service_loc)
              OR (temp14.sak_pr_other_2     = a.sak_prov
                   and     temp14.cde_svc_loc_other_2 = a.cde_service_loc)
              OR (temp14.sak_pr_attend     = a.sak_prov
                   and     temp14.cde_svc_loc_attend = a.cde_service_loc)
              OR (temp14.sak_pr_other     = a.sak_prov
                   and     temp14.cde_svc_loc_other = a.cde_service_loc)
              OR     temp14.id_prov_attend     = to_char(a.sak_prov) || a.cde_service_loc
              OR     temp14.id_prov_other     = to_char(a.sak_prov) || a.cde_service_loc
              OR     temp14.id_prov_other_2     = to_char(a.sak_prov) || a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp14.DTE_FINAL)     >= :il_prev_18_months
                   OR     NVL(MAX(temp14.DTE_FINAL),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_dental_dtl temp15
              WHERE temp15.sak_prov_perf     = a.sak_prov
                   and temp15.cde_svc_loc_perf     = a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp15.DTE_FIRST_SVC) >= :il_prev_18_months
                   OR     NVL(MAX(temp15.DTE_FIRST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_dental_hdr temp16
              WHERE ( (temp16.sak_prov_perf     = a.sak_prov
                   and     temp16.cde_perf_svc_loc = a.cde_service_loc)
              OR (temp16.sak_prov_referring = a.sak_prov
                   and     temp16.cde_svc_loc_ref_1 = a.cde_service_loc)
              OR (temp16.sak_prov_referring_2 = a.sak_prov
                   and     temp16.cde_svc_loc_ref_2 = a.cde_service_loc)
              OR (temp16.prov_billing     = a.sak_prov
                   and     temp16.cde_service_loc     = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING ((MAX(temp16.DTE_LAST_SVC) >= :il_prev_18_months
                   OR     NVL(MAX(temp16.DTE_LAST_SVC),0) = 0)
                   and (MAX(temp16.DTE_BILLED) >= :il_prev_18_months
                   OR     NVL(MAX(temp16.DTE_BILLED),0) = 0) )
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phrm_hdr temp17
              WHERE ( (temp17.prov_billing     = a.sak_prov
                   and     temp17.cde_service_loc     = a.cde_service_loc)
              OR (temp17.sak_prov_rend     = a.sak_prov
                   and     temp17.cde_svc_loc_rend = a.cde_service_loc)
              OR (temp17.sak_presc_prov     = a.sak_prov
                   and     temp17.cde_svc_loc_presc = a.cde_service_loc)
              OR     temp17.id_prov_prescrb     = to_char(a.sak_prov) || a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp17.DTE_BILLED)     >= :il_prev_18_months
                   OR     NVL(MAX(temp17.DTE_BILLED),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phys_dtl temp18
              WHERE ( (temp18.sak_prov_perf     = a.sak_prov
                   and     temp18.cde_svc_loc_rend = a.cde_service_loc)
              OR (temp18.sak_prov_referring = a.sak_prov
                   and     temp18.cde_svc_loc_ref_1 = a.cde_service_loc)
              OR (temp18.sak_prov_referring_2 = a.sak_prov
                   and     temp18.cde_svc_loc_ref_2 = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp18.DTE_LAST_SVC)     >= :il_prev_18_months
                   OR     NVL(MAX(temp18.DTE_LAST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phys_hdr temp19
              WHERE ( (temp19.prov_billing     = a.sak_prov
                   and     temp19.cde_service_loc     = a.cde_service_loc)
              OR (temp19.sak_prov_perf     = a.sak_prov
                   and     temp19.cde_perf_svc_loc = a.cde_service_loc)
              OR (temp19.sak_prov_referring = a.sak_prov
                   and     temp19.cde_svc_loc_ref_1 = a.cde_service_loc)
              OR (temp19.sak_prov_referring_2 = a.sak_prov
                   and     temp19.cde_svc_loc_ref_2 = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING ((MAX(temp19.DTE_LAST_SVC) >= :il_prev_18_months
                   OR     NVL(MAX(temp19.DTE_LAST_SVC),0) = 0)
                   and (MAX(temp19.DTE_BILLED)     >= :il_prev_18_months
                   OR     NVL(MAX(temp19.DTE_BILLED),0) = 0) )
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_ub92_dtl temp20
              WHERE ( (temp20.sak_pr_other     = a.sak_prov
                   and     temp20.cde_scv_loc_other = a.cde_service_loc)
                   OR (temp20.sak_pr_other_2     = a.sak_prov
                   and     temp20.cde_svc_loc_other_2 = a.cde_service_loc)
                   OR (temp20.sak_pr_attend     = a.sak_prov
                   and     temp20.cde_svc_loc_attend = a.cde_service_loc)
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING     MAX(temp20.DTE_LAST_SVC)     >= :il_prev_18_months
                   OR     NVL(MAX(temp20.DTE_LAST_SVC),0) = 0
    union
    select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_ub92_hdr temp22
              WHERE ( (temp22.prov_billing     = a.sak_prov
                   and     temp22.cde_service_loc     = a.cde_service_loc)
              OR (temp22.sak_pr_facility     = a.sak_prov
                   and     temp22.cde_svc_loc_fa     = a.cde_service_loc)
              OR (temp22.sak_pr_other_2     = a.sak_prov
                   and     temp22.cde_svc_loc_other_2 = a.cde_service_loc)
              OR (temp22.sak_pr_attend     = a.sak_prov
                   and     temp22.cde_svc_loc_attend = a.cde_service_loc)
              OR (temp22.sak_pr_other     = a.sak_prov
                   and     temp22.cde_svc_loc_other = a.cde_service_loc)
              OR     temp22.id_prov_attend     = to_char(a.sak_prov) || a.cde_service_loc
              OR     temp22.id_prov_other     = to_char(a.sak_prov) || a.cde_service_loc
              OR     temp22.id_prov_other_2     = to_char(a.sak_prov) || a.cde_service_loc
                   GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
              HAVING MAX(temp22.DTE_BILLED)     >= :il_prev_18_months
                   OR     NVL(MAX(temp22.DTE_BILLED),0) = 0
    );

    Perhaps an approach like this would work better. No promises, but it's worth a try.
    SELECT *
      FROM pr_php_elig_tmp a
    WHERE NOT EXISTS (
             SELECT   a.sak_prov,
                      a.cde_service_loc,
                      a.sak_short
                 FROM aim01.t_deny_dntl_dtl temp01
                WHERE temp01.sak_prov_perf = a.sak_prov
                  AND temp01.cde_svc_loc_perf = a.cde_service_loc
             GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
               HAVING MAX (temp01.dte_first_svc) >= :il_prev_18_months
                   OR NVL (MAX (temp01.dte_first_svc), 0) = 0)
       AND NOT EXISTS (
             SELECT   a.sak_prov,
                      a.cde_service_loc,
                      a.sak_short
                 FROM aim01.t_deny_dntl_hdr temp02
                WHERE (   (    temp02.prov_billing = a.sak_prov
                           AND temp02.cde_service_loc = a.cde_service_loc)
                       OR (    temp02.sak_prov_perf = a.sak_prov
                           AND temp02.cde_perf_svc_loc = a.cde_service_loc)
                       OR (    temp02.sak_prov_referring = a.sak_prov
                           AND temp02.cde_svc_loc_ref_1 = a.cde_service_loc)
                       OR (    temp02.sak_prov_referring_2 = a.sak_prov
                           AND temp02.cde_svc_loc_ref_2 = a.cde_service_loc))
             GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
               HAVING MAX (temp02.dte_final) >= :il_prev_18_months
                   OR NVL (MAX (temp02.dte_final), 0) = 0)

  • Pl-Sql Oracle Function Concurrency Issue

    Hi All,
    Issue - pl-sql Oracle Function performance issue, when muliple users are accessing the function
    Detail -
    Oracle 11g / Linux Server
    I have developed a pl-sql oracle function to retrieve information from 3 tables, output as a particluar type array.
    Single request is getting processed within 2.2 seconds, but when multiple request are sent concurrently <tested with 50>, time taken for each output is different.
    BreakUp of Response times:-
    8 messages took - 2.2 sec
    +8 messages took - 4.4 sec
    ++8 messages took - 6.6 sec....etc
    I'm looking for any DB tunning parameter, which will help to resolve this issue.
    My only aim is to expose developed function to multiple users, who all can access it concurrently, but response should limit within 2.2 seconds.
    Any thoughts + guidance is higly appreciated.
    Thanks
    Preetam Singh

    Supporting data insert statements:
    =======================================================================================================================
    REM INSERTING into EXPERTISE
    Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('A','ENGLISH','FRENCH','HINDI',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('B',null,'GERMAN','CHINIESE','HINDI',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('C','ENGLISH',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    =======================================================================================================================
    ==================================================================
    REM INSERTING into WORKING
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','MON','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','TUE','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','WED',null,null);
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','THU','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','FRI','09:00','12:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','MON','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','TUE','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','WED','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','THU','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','FRI','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','MON',null,null);
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','TUE','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','WED','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','THU','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','FRI','09:00','12:00');
    ==================================================================
    =====================================================================================================================
    REM INSERTING into SCHEDULE
    Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','A');
    Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'TRAINING','B');
    Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('13-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','A');
    Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.30.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','B');
    =====================================================================================================================
    Edited by: 910614 on Feb 10, 2012 9:29 AM

  • Performance issue with view selection after migration from oracle to MaxDb

    Hello,
    After the migration from oracle to MaxDb we have serious performance issues with a lot of our tableview selections.
    Does anybody know about this problem and how to solve it ??
    Best regards !!!
    Gert-Jan

    Hello Gert-Jan,
    most probably you need additional indexes to get better performance.
    Using the command monitor you can identify the long running SQL statements and check the optimizer access strategy. Then you can decide which indexes might help.
    If this is about an SAP system, you can find additional information about performance analysis in SAP notes 725489 and 819641.
    SAP Hosting provides the so-called service 'MaxDB Migration Support' to help you in such cases. The service description can be found here:
    http://www.saphosting.de/mediacenter/pdfs/solutionbriefs/MaxDB_de.pdf
    http://www.saphosting.com/mediacenter/pdfs/solutionbriefs/maxDB-migration-support_en.pdf.
    Best regards,
    Melanie Handreck

  • Performance issues with dynamic action (PL/SQL)

    Hi!
    I'm having perfomance issues with a dynamic action that is triggered on a button click.
    I have 5 drop down lists to select columns which the users want to filter, 5 drop down lists to select an operation and 5 boxes to input values.
    After that, there is a filter button that just submits the page based on the selected filters.
    This part works fine, the data is filtered almost instantaneously.
    After this, I have 3 column selectors and 3 boxes where users put values they wish to update the filtered rows to,
    There is an update button that calls the dynamic action (procedure that is written below).
    It should be straight out, the only performance issue could be the decode section, because I need to cover cases when user wants to set a value to null (@) and when he doesn't want update 3 columns, but less (he leaves '').
    Hence P99_X_UC1 || ' = decode('  || P99_X_UV1 ||','''','|| P99_X_UC1  ||',''@'',null,'|| P99_X_UV1  ||')
    However when I finally click the update button, my browser freezes and nothing happens on the table.
    Can anyone help me solve this and improve the speed of the update?
    Regards,
    Ivan
    P.S. The code for the procedure is below:
    create or replace
    PROCEDURE DWP.PROC_UPD
    (P99_X_UC1 in VARCHAR2,
    P99_X_UV1 in VARCHAR2,
    P99_X_UC2 in VARCHAR2,
    P99_X_UV2 in VARCHAR2,
    P99_X_UC3 in VARCHAR2,
    P99_X_UV3 in VARCHAR2,
    P99_X_COL in VARCHAR2,
    P99_X_O in VARCHAR2,
    P99_X_V in VARCHAR2,
    P99_X_COL2 in VARCHAR2,
    P99_X_O2 in VARCHAR2,
    P99_X_V2 in VARCHAR2,
    P99_X_COL3 in VARCHAR2,
    P99_X_O3 in VARCHAR2,
    P99_X_V3 in VARCHAR2,
    P99_X_COL4 in VARCHAR2,
    P99_X_O4 in VARCHAR2,
    P99_X_V4 in VARCHAR2,
    P99_X_COL5 in VARCHAR2,
    P99_X_O5 in VARCHAR2,
    P99_X_V5 in VARCHAR2,
    P99_X_CD in VARCHAR2,
    P99_X_VD in VARCHAR2
    ) IS
    l_sql_stmt varchar2(32600);
    p_table_name varchar2(30) := 'DWP.IZV_SLOG_DET'; 
    BEGIN
    l_sql_stmt := 'update ' || p_table_name || ' set '
    || P99_X_UC1 || ' = decode('  || P99_X_UV1 ||','''','|| P99_X_UC1  ||',''@'',null,'|| P99_X_UV1  ||'),'
    || P99_X_UC2 || ' = decode('  || P99_X_UV2 ||','''','|| P99_X_UC2  ||',''@'',null,'|| P99_X_UV2  ||'),'
    || P99_X_UC3 || ' = decode('  || P99_X_UV3 ||','''','|| P99_X_UC3  ||',''@'',null,'|| P99_X_UV3  ||') where '||
    P99_X_COL  ||' '|| P99_X_O  ||' ' || P99_X_V  || ' and ' ||
    P99_X_COL2 ||' '|| P99_X_O2 ||' ' || P99_X_V2 || ' and ' ||
    P99_X_COL3 ||' '|| P99_X_O3 ||' ' || P99_X_V3 || ' and ' ||
    P99_X_COL4 ||' '|| P99_X_O4 ||' ' || P99_X_V4 || ' and ' ||
    P99_X_COL5 ||' '|| P99_X_O5 ||' ' || P99_X_V5 || ' and ' ||
    P99_X_CD   ||       ' = '         || P99_X_VD ;
    --dbms_output.put_line(l_sql_stmt); 
    EXECUTE IMMEDIATE l_sql_stmt;
    END;

    Hi Ivan,
    I do not think that the decode is performance relevant. Maybe the update hangs because some other transaction has uncommitted changes to one of the affected rows or the where clause is not selective enough and needs to update a huge amount of records.
    Besides that - and I might be wrong, because I only know some part of your app - the code here looks like you have a huge sql injection vulnerability here. Maybe you should consider re-writing your logic in static sql. If that is not possible, you should make sure that the user input only contains allowed values, e.g. by white-listing P99_X_On (i.e. make sure they only contain known values like '=', '<', ...), and by using dbms_assert.enquote_name/enquote_literal on the other P99_X_nnn parameters.
    Regards,
    Christian

  • SQL Server 2000 std Report Performance Issue

    Dear All,
    I have a VB based desktop application with back end MS SQL server 2000 database with server machine ibmx5650 with specs intel xeon 2.7GHz (24 CPU's) & 24GB RAM.
    There are two things i need help:
    Recently we have upgrade the SQL server from 2000 personal edition to the 2000 standard edition. There comes a problem with one of the Report in the application. The report took almost 30 mins previously in SQL 2000 personal edition.But after the upgrade
     to Standard edition we are unable to view report before 3 hours even sometimes it doesn't appear after several hours.
    Secondly for brief testing i have installed the personal edition on a simple PC rather then a server PC specs are corei5 & 4 GB of RAM. The same report is generated in only 15 mins from the application with this desktop machine as DB server.
    Please help me out i have gone through all SQL Server & system performance log of my server machine everything is normal but the report is taking too long & i can only generate that report from personal edition.
    Is there the difference due the higher corei5 processor in desktop machine or there is any other issue behind this.
    Your prompt response is highly appreciated.
    Regards,
    Rashid Ali

    Hello,
    SQL Server 2000 is not support since 2013. Please upgrade to SQL Server 2012 to get better performance and support.
    Thanks for your understanding and support.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • Performance issue with pl/sql code

    Hi Oracle Gurus,
    I am in need of your recommendations for a performance issue that I am facing in production envrionment. There is a pl/sql procedure which executes with different elapsed time at different executions. Elapsed Times are 30minutes , 40 minutes, 65 minutes , 3 minutes ,3 seconds.
    Expected elapsed time is maximum of 3 minutes. ( But some times it took 3 seconds too...! )
    Output on all different executions are same that is deletion and insertion of 12K records into a table.
    Here is the auto trace details of two different scenarios.
    Slow execution - 33.65 minutes
    Stat Name                                Statement   Per Execution % Snap
    Elapsed Time (ms)                         1,712,343    1,712,342.6    41.4
    CPU Time (ms)                             1,679,689    1,679,688.6    44.7
    Executions                                        1            N/A     N/A
    Buffer Gets                              ##########  167,257,973.0    86.9
    Disk Reads                                    1,284        1,284.0     0.4
    Parse Calls                                       1            1.0     0.0
    User I/O Wait Time (ms)                       4,264            N/A     N/A
    Cluster Wait Time (ms)                        3,468            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                        6            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     4            N/A     N/A
    Sharable Mem(KB)                                 85            N/A     N/A
              -------------------------------------------------------------Fast Exection : 5 seconds
    Stat Name                                Statement   Per Execution % Snap
    Elapsed Time (ms)                            41,550       41,550.3     0.7
    CPU Time (ms)                                40,776       40,776.3     1.0
    Executions                                        1            N/A     N/A
    Buffer Gets                               2,995,677    2,995,677.0     4.2
    Disk Reads                                       22           22.0     0.0
    Parse Calls                                       1            1.0     0.0
    User I/O Wait Time (ms)                         162            N/A     N/A
    Cluster Wait Time (ms)                          621            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                       55            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     4            N/A     N/A
    Sharable Mem(KB)                                 85            N/A     N/A
              -------------------------------------------------------------For security reasons, I cannot share the actual code. Its a report generating code that deletes and load the data into table using insert into select statement.
    Delete from table ;
    cursor X to get the master data ( 98 records )
    For each X loop
    insert into tableA select * from tables where a= X.a and b= X.b and c=X.c ..... ;
    -- 12 K records inserted on average
    insert into tableB select * from tables where a= X.a and b= X.b and c=X.c ..... ;
    -- 12 K records inserted on average
    end loop ;1. The select query is complex with bind variables ( explain plan varies for each values )
    2. I have checked the tablespace of the tables involved, it is 82% used. DBA confirmed that it is not the reason.
    3. Disk reads are high during long execution.
    4. At long running times, I can see a db sequential read wait event on a index object. This index is on the table where data is inserted.
    All I need to find is why this code is taking 3 seconds and 60 minutes on the same day and on the consecutive executions ?
    Is there any other approach to find the root cause of this behaviour and to fix it ? Kindly adivse.
    Thanks in advance your help.
    Regards,
    Hari
    Edited by: BluShadow on 26-Sep-2012 08:24
    edited to add {noformat}{noformat} tags.  You've been a member long enough to know to do this yourself... so please do so in future.  ({message:id=9360002})                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hariharan ST wrote:
    Hi Oracle Gurus,
    I am in need of your recommendations for a performance issue that I am facing in production envrionment. There is a pl/sql procedure which executes with different elapsed time at different executions. Please reedit your post and add some code tags around the trace information. This would improve readability greatly and will help us to help you
    example
    {<b></b>code}
    select * from dual;{<b></b>code}
    Based upon your description I can imagine two things.
    a) The execution plan for the select query does change frequently.
    A typical reason can be not up to date statistics.
    b) Some locking / wait conflict. For example upon a UK index.
    Are there any other operations going on while it is slow? If anybody inserts a value, then your session will wait, if the same (PK/UK) value also is to be inserted.
    Those wait events can be recognized using standard tools like oracle sql developer or enterprise manager while the query is slow.
    Also go through the links that are in the FAQ. They tell you how to get better information for makeing a tuning request.
    SQL and PL/SQL FAQ
    Edited by: Sven W. on Sep 25, 2012 6:41 PM

  • Database migrated from Oracle 10g to 11g Discoverer report performance issu

    Hi All,
    We are now getting issue in Discoverer Report performance as the report is keep on running when database got upgrade from 10g to 11g.
    In database 10g the report is working fine but the same report is not working fine in 11g.
    The query i have changed as I have passed the date format TO_CHAR("DD-MON-YYYY" and removed the NVL & TRUNC function from the existing query.
    The report is now working fine in Database 11g backhand but when I am using the same query in Discoverer it is not working and report is keep on running.
    Please advise.
    Regards,

    Pl post exact OS, database and Discoverer versions. After the upgrade, have statistics been updated ? Have you traced the Discoverer query to determine where the performance issue is ?
    How To Find Oracle Discoverer Diagnostic and Tracing Guides [ID 290658.1]
    How To Enable SQL Tracing For Discoverer Sessions [ID 133055.1]
    Discoverer 11g: Performance degradation after Upgrade to Database 11g [ID 1514929.1]
    HTH
    Srini

  • Performance Issue on REISBP since SQL Server upgrade to 2005

    We recently upgrade our database from 2000 to 2005, using ECC5 (that didn't change).  Since the upgrade one transaction in particular has taken a big hit... REISBP.  It can range from seconds to 15+ minutes now to complete, which didn't happen before.  the underlying table is BUT000.
    Has anyone experienced this?  Or other significant slowdowns after an upgrade.
    (on a 32 bit Windows NT server - can't do anything about that for now.)
    Thanks
    Laurie

    I did run the STO5 sql trace and the issue is with the vibpobjrel table part query.  There are no further indexes to put on that table tho help out, based on how the users are accessing the report.  Based on how they are using the report, several thousand records can be returned, which are then parsed as parms in the next part of the report where a "for all entries" clause is used... causing many union all statements.
    What I don't understand is why the average execution time was much less, using the same criteria, in SQL 2000.
    At this time we've instructed the users to not use a text criteria in the name field if at all possible, as this forces reading the entire BUT000 table, multiple times based on the return from vibpobjrel.
    Perhaps this is just a taste of the 2005 performance on our systems.  I do see some increased times for other transaction over the previous version, but none stand out as much as this one.
    Thanks,
    Laurie

  • SQL Query with a little bit more complicated WHERE clause performance issue

    Hello, I have some performance issue in this case:
    Very simplified query:
    SELECT COUNT(*) FROM Items
    WHERE
    ConditionA OR
    ConditionB OR
    ConditionC OR ...
    Simply I have to determine how many Items the user has access through some complicated conditions.
    When there is a large number of records (100,000+) in the Items table and say ~10 complicated conditions concatenated in WHERE clause, I get the result about 2 seconds in my case. The problem is when very few conditions are met, f.e. when I get only
    10 Items from 100,000.
    How can I improve the performace in this "Get my items" case?
    Additional information:
    the query is generated by EF 6.1
    MS SQL 2012 Express
    Here is the main part of the real SQL Execution Plan:

    Can you post table/index DDL?  Query?
    Sample query:
    exec sp_executesql N'SELECT
    [GroupBy1].[A1] AS [C1]
    FROM ( SELECT
    COUNT(1) AS [A1]
    FROM [dbo].[Tickets] AS [Extent1]
    LEFT OUTER JOIN [dbo].[Services] AS [Extent2] ON [Extent1].[ServiceId] = [Extent2].[Id]
    WHERE (@p__linq__0 = 1) OR ([Extent1].[SubmitterKey] = @p__linq__1) OR ([Extent1].[OperatorKey] = @p__linq__2) OR (([Extent1].[OperatorKey] IS NULL) AND (@p__linq__2 IS NULL)) OR ([Extent1].[SolverKey] = @p__linq__3) OR (([Extent1].[SolverKey] IS NULL) AND (@p__linq__3 IS NULL)) OR ([Extent1].[Incident2ndLineSupportKey] = @p__linq__4) OR (([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (@p__linq__4 IS NULL)) OR ((@p__linq__5 = 1) AND ((1 = CAST( [Extent1].[TicketType] AS int)) OR ((@p__linq__6 = 1) AND (((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[IncidentManager] = @p__linq__7) OR (([Extent2].[IncidentManager] IS NULL) AND (@p__linq__7 IS NULL)))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ServiceRequestManager] = @p__linq__8) OR (([Extent2].[ServiceRequestManager] IS NULL) AND (@p__linq__8 IS NULL)))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ProblemManager] = @p__linq__9) OR (([Extent2].[ProblemManager] IS NULL) AND (@p__linq__9 IS NULL)))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ChangeManager] = @p__linq__10) OR (([Extent2].[ChangeManager] IS NULL) AND (@p__linq__10 IS NULL)))))) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceDeputyManagers] AS [Extent3]
    WHERE ([Extent1].[ServiceId] = [Extent3].[ServiceId]) AND ( CAST( [Extent3].[TicketType] AS int) = CAST( [Extent1].[TicketType] AS int)) AND ([Extent3].[UserProviderKey] = @p__linq__11)
    )))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[Incident1stLineSupportLimitedAccess] <> cast(1 as bit))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ServiceRequestLimitedAccess] <> cast(1 as bit))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND ([Extent2].[ProblemLimitedAccess] <> cast(1 as bit))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ChangeLimitedAccess] <> cast(1 as bit))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent4]
    WHERE ([Extent1].[ServiceId] = [Extent4].[ServiceId]) AND (2 = CAST( [Extent4].[TicketType] AS int)) AND ([Extent4].[UserProviderKey] = @p__linq__12) AND (1 = [Extent4].[SupportLine])
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent5]
    WHERE ([Extent5].[UserProviderKey] = @p__linq__13) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent6]
    WHERE ([Extent6].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent6].[TicketType] AS int)) AND (1 = [Extent6].[SupportLine]) AND ([Extent6].[OperatorGroupId] = [Extent5].[OperatorGroupId])
    )))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent1].[IncidentFunctionEscalatedTo2ndLineSupport] = 1) AND ([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (([Extent2].[Incident2ndLineSupportLimitedAccess] <> cast(1 as bit)) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent7]
    WHERE ([Extent1].[ServiceId] = [Extent7].[ServiceId]) AND (2 = CAST( [Extent7].[TicketType] AS int)) AND ([Extent7].[UserProviderKey] = @p__linq__14) AND (2 = [Extent7].[SupportLine])
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent8]
    WHERE ([Extent8].[UserProviderKey] = @p__linq__15) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent9]
    WHERE ([Extent9].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent9].[TicketType] AS int)) AND (2 = [Extent9].[SupportLine]) AND ([Extent9].[OperatorGroupId] = [Extent8].[OperatorGroupId])
    )))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = CAST( [Extent1].[TicketState] AS int)) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent10]
    WHERE ([Extent1].[ServiceId] = [Extent10].[ServiceId]) AND (3 = CAST( [Extent10].[TicketType] AS int)) AND ([Extent10].[UserProviderKey] = @p__linq__16)
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent11]
    WHERE ([Extent11].[UserProviderKey] = @p__linq__17) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent12]
    WHERE ([Extent12].[ServiceId] = [Extent1].[ServiceId]) AND (3 = CAST( [Extent12].[TicketType] AS int)) AND ([Extent12].[OperatorGroupId] = [Extent11].[OperatorGroupId])
    )))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND (( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent13]
    WHERE ([Extent1].[ServiceId] = [Extent13].[ServiceId]) AND (4 = CAST( [Extent13].[TicketType] AS int)) AND ([Extent13].[UserProviderKey] = @p__linq__18)
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent14]
    WHERE ([Extent14].[UserProviderKey] = @p__linq__19) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent15]
    WHERE ([Extent15].[ServiceId] = [Extent1].[ServiceId]) AND (4 = CAST( [Extent15].[TicketType] AS int)) AND ([Extent15].[OperatorGroupId] = [Extent14].[OperatorGroupId])
    )))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent16]
    WHERE ([Extent1].[ServiceId] = [Extent16].[ServiceId]) AND (5 = CAST( [Extent16].[TicketType] AS int)) AND ([Extent16].[UserProviderKey] = @p__linq__20)
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent17]
    WHERE ([Extent17].[UserProviderKey] = @p__linq__21) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent18]
    WHERE ([Extent18].[ServiceId] = [Extent1].[ServiceId]) AND (5 = CAST( [Extent18].[TicketType] AS int)) AND ([Extent18].[OperatorGroupId] = [Extent17].[OperatorGroupId])
    )))) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[TicketInvitations] AS [Extent19]
    WHERE ([Extent19].[TicketId] = [Extent1].[Id]) AND (([Extent19].[InvitedUserProviderKey] = @p__linq__22) OR (([Extent19].[InvitedUserProviderKey] IS NULL) AND (@p__linq__22 IS NULL)))
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM (SELECT
    [Extent20].[CustomerId] AS [CustomerId]
    FROM [dbo].[CustomerUsers] AS [Extent20]
    WHERE ([Extent20].[UserProviderKey] = @p__linq__23) AND ([Extent20].[CanAccessOthersTickets] = 1)
    INTERSECT
    SELECT
    [Extent21].[CustomerId] AS [CustomerId]
    FROM [dbo].[CustomerUsers] AS [Extent21]
    WHERE [Extent21].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect1]
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM (SELECT
    [Extent22].[InternalGroupId] AS [InternalGroupId]
    FROM [dbo].[InternalGroupUsers] AS [Extent22]
    WHERE ([Extent22].[UserProviderKey] = @p__linq__24) AND ([Extent22].[CanAccessOthersTickets] = 1)
    INTERSECT
    SELECT
    [Extent23].[InternalGroupId] AS [InternalGroupId]
    FROM [dbo].[InternalGroupUsers] AS [Extent23]
    WHERE [Extent23].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect2]
    ) AS [GroupBy1]',N'@p__linq__0 bit,@p__linq__1 varchar(8000),@p__linq__2 varchar(8000),@p__linq__3 varchar(8000),@p__linq__4 varchar(8000),@p__linq__5 bit,@p__linq__6 bit,@p__linq__7 varchar(8000),@p__linq__8 varchar(8000),@p__linq__9 varchar(8000),@p__linq__10 varchar(8000),@p__linq__11 varchar(8000),@p__linq__12 varchar(8000),@p__linq__13 varchar(8000),@p__linq__14 varchar(8000),@p__linq__15 varchar(8000),@p__linq__16 varchar(8000),@p__linq__17 varchar(8000),@p__linq__18 varchar(8000),@p__linq__19 varchar(8000),@p__linq__20 varchar(8000),@p__linq__21 varchar(8000),@p__linq__22 varchar(8000),@p__linq__23 varchar(8000),@p__linq__24 varchar(8000)',@p__linq__0=0,@p__linq__1='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__2='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__3='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__4='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__5=1,@p__linq__6=0,@p__linq__7='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__8='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__9='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__10='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__11='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__12='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__13='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__14='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__15='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__16='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__17='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__18='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__19='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__20='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__21='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__22='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__23='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__24='31555851-b89d-4a15-bb05-5a6fd42f9552'
    Generated DDL for related tables: (indexes are primary on PKs and FKs)
    CREATE TABLE [dbo].[CustomerUsers](
    [UserProviderKey] [varchar](184) NOT NULL,
    [CustomerId] [int] NOT NULL,
    [CanAccessOthersTickets] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.CustomerUsers] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[InternalGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[InternalGroupUsers](
    [UserProviderKey] [varchar](184) NOT NULL,
    [InternalGroupId] [int] NOT NULL,
    [CanAccessOthersTickets] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.InternalGroupUsers] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC,
    [InternalGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[OperatorGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[OperatorGroupUsers](
    [UserProviderKey] [varchar](184) NOT NULL,
    [OperatorGroupId] [int] NOT NULL,
    CONSTRAINT [PK_dbo.OperatorGroupUsers] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC,
    [OperatorGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[ServiceDeputyManagers] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[ServiceDeputyManagers](
    [UserProviderKey] [varchar](184) NOT NULL,
    [ServiceId] [int] NOT NULL,
    [TicketType] [int] NOT NULL,
    CONSTRAINT [PK_dbo.ServiceDeputyManagers] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC,
    [ServiceId] ASC,
    [TicketType] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[ServiceOperatorGroups] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[ServiceOperatorGroups](
    [ServiceId] [int] NOT NULL,
    [OperatorGroupId] [int] NOT NULL,
    [TicketTypeValue] [int] NOT NULL,
    [SupportLine] [int] NOT NULL,
    [TicketType] [int] NOT NULL,
    CONSTRAINT [PK_dbo.ServiceOperatorGroups] PRIMARY KEY CLUSTERED
    [ServiceId] ASC,
    [OperatorGroupId] ASC,
    [TicketTypeValue] ASC,
    [SupportLine] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    /****** Object: Table [dbo].[ServiceOperators] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[ServiceOperators](
    [UserProviderKey] [varchar](184) NOT NULL,
    [ServiceId] [int] NOT NULL,
    [TicketTypeValue] [int] NOT NULL,
    [SupportLine] [int] NOT NULL,
    [TicketType] [int] NOT NULL,
    CONSTRAINT [PK_dbo.ServiceOperators] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC,
    [ServiceId] ASC,
    [TicketTypeValue] ASC,
    [SupportLine] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[Services] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Services](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [ParentId] [int] NULL,
    [Name] [nvarchar](256) NOT NULL,
    [Description] [nvarchar](max) NULL,
    [Disabled] [bit] NOT NULL,
    [NewTicketLimitedAccess] [bit] NOT NULL,
    [Incident1stLineSupportLimitedAccess] [bit] NOT NULL,
    [Incident2ndLineSupportLimitedAccess] [bit] NOT NULL,
    [ServiceRequestLimitedAccess] [bit] NOT NULL,
    [ProblemLimitedAccess] [bit] NOT NULL,
    [ServiceRequestManager] [varchar](184) NOT NULL,
    [IncidentManager] [varchar](184) NOT NULL,
    [ProblemManager] [varchar](184) NOT NULL,
    [Deleted] [bit] NOT NULL,
    [WfDisableIncidentAssignedState] [bit] NOT NULL,
    [WfDisableIncidentConfirmedState] [bit] NOT NULL,
    [WfDisableIncidentTakeFromQueueAction] [bit] NOT NULL,
    [WfDisableIncidentFinishSolutionAction] [bit] NOT NULL,
    [WfDisableServiceRequestAssignedState] [bit] NOT NULL,
    [WfDisableServiceRequestConfirmedState] [bit] NOT NULL,
    [WfDisableServiceRequestTakeFromQueueAction] [bit] NOT NULL,
    [WfDisableServiceRequestFinishSolutionAction] [bit] NOT NULL,
    [WfDisableServiceRequestPostponeAction] [bit] NOT NULL,
    [ChangeLimitedAccess] [bit] NOT NULL,
    [ChangeManager] [varchar](184) NOT NULL,
    [WfDisableChangeTakeFromQueueAction] [bit] NOT NULL,
    [WfDisableChangeAssignedState] [bit] NOT NULL,
    [WfDisableChangeStartPreparationAction] [bit] NOT NULL,
    [IsDepartment] [bit] NOT NULL,
    [InheritsFromDepartment] [bit] NOT NULL,
    [AllowSelectSolverBySubmitterForIncidents] [bit] NOT NULL,
    [AllowSelectSolverBySubmitterForServiceRequests] [bit] NOT NULL,
    [AllowSelectSolverBySubmitterForProblems] [bit] NOT NULL,
    [AllowSelectSolverBySubmitterForChanges] [bit] NOT NULL,
    [AllowAccessToOtherOperatorsIncidents] [bit] NOT NULL,
    [AllowAccessToOtherOperatorsServiceRequests] [bit] NOT NULL,
    [AllowAccessToOtherOperatorsProblems] [bit] NOT NULL,
    [AllowAccessToOtherOperatorsChanges] [bit] NOT NULL,
    [AllowChangeDeadlineForIncidents] [bit] NOT NULL,
    [AllowChangeDeadlineForServiceRequests] [bit] NOT NULL,
    [AllowChangeDeadlineForProblems] [bit] NOT NULL,
    [AllowChangeDeadlineForChanges] [bit] NOT NULL,
    [AllowSelectPriorityForServiceRequests] [bit] NOT NULL,
    [WfDisableIncidentCompletedState] [bit] NOT NULL,
    [WfDoIncidentCompleteActionBySubmittersMessage] [bit] NOT NULL,
    [WfDisableServiceRequestCompletedState] [bit] NOT NULL,
    [WfDoServiceRequestCompleteActionBySubmittersMessage] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.Services] PRIMARY KEY CLUSTERED
    [Id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[TicketInvitations] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[TicketInvitations](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [TicketId] [int] NOT NULL,
    [InitiatorUserProviderKey] [varchar](184) NULL,
    [InitiatorFullName] [nvarchar](max) NULL,
    [InvitedUserProviderKey] [varchar](184) NULL,
    [InvitedFullName] [nvarchar](max) NULL,
    [Type] [int] NOT NULL,
    [CreatedUTC] [datetime] NOT NULL,
    CONSTRAINT [PK_dbo.TicketInvitations] PRIMARY KEY CLUSTERED
    [Id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[Tickets] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Tickets](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [ParentId] [int] NULL,
    [ServiceId] [int] NULL,
    [ServiceMailboxId] [int] NULL,
    [TicketTypeValue] [int] NOT NULL,
    [TicketTypeIdREF] [int] NOT NULL,
    [SubmitterKey] [varchar](184) NOT NULL,
    [SubmitterFullName] [nvarchar](256) NULL,
    [CustomerId] [int] NULL,
    [SolverKey] [varchar](184) NULL,
    [SolverFullName] [nvarchar](256) NULL,
    [Subject] [nvarchar](max) NULL,
    [CreatedUTC] [datetime] NOT NULL,
    [Archived] [bit] NOT NULL,
    [MarkedAsSolvedUTC] [datetime] NULL,
    [ArchivedUTC] [datetime] NULL,
    [TicketSourceValue] [int] NOT NULL,
    [OperatorKey] [varchar](184) NULL,
    [DeadlineUTC] [datetime] NULL,
    [DeadlineLastNotificatedPercentage] [int] NULL,
    [UrgencyValue] [int] NULL,
    [ImpactValue] [int] NULL,
    [PriorityValue] [int] NULL,
    [TicketStateValue] [int] NOT NULL,
    [IncidentFunctionEscalatedTo2ndLineSupport] [bit] NOT NULL,
    [Incident2ndLineSupportKey] [varchar](184) NULL,
    [Incident2ndLineSupportFullName] [nvarchar](max) NULL,
    [TicketType] [int] NOT NULL,
    [Source] [int] NOT NULL,
    [TicketState] [int] NOT NULL,
    [Urgency] [int] NULL,
    [Impact] [int] NULL,
    [TicketSummaryState] [int] NOT NULL,
    [ResolutionText] [nvarchar](max) NULL,
    [ResolutionModifiedUTC] [datetime] NULL,
    [ResolutionEdited] [bit] NOT NULL,
    [ResolutionUserProviderKey] [varchar](184) NULL,
    [ResolutionFullName] [nvarchar](max) NULL,
    [TicketSubType] [int] NULL,
    [ChangeRiskProbabilityValue] [int] NULL,
    [ChangeImpactValue] [int] NULL,
    [ChangeRiskCategoryValue] [int] NULL,
    [RfcText] [nvarchar](max) NULL,
    [RfcModifiedUTC] [datetime] NULL,
    [RfcEdited] [bit] NOT NULL,
    [RfcUserProviderKey] [varchar](184) NULL,
    [RfcFullName] [nvarchar](max) NULL,
    [ManualDeadline] [bit] NOT NULL,
    [ContactInformation] [nvarchar](256) NULL,
    [Imported] [bit] NOT NULL,
    [ForceClosed] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.Tickets] PRIMARY KEY CLUSTERED
    [Id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[CustomerUsers]
    [CustomerId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_InternalGroupId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_InternalGroupId] ON [dbo].[InternalGroupUsers]
    [InternalGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[OperatorGroupUsers]
    [OperatorGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceDeputyManagers]
    [ServiceId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[ServiceOperatorGroups]
    [OperatorGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperatorGroups]
    [ServiceId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperators]
    [ServiceId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Services]
    [ParentId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_TicketId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_TicketId] ON [dbo].[TicketInvitations]
    [TicketId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_TicketInvitations_InvitedUserProviderKey_TicketId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE UNIQUE NONCLUSTERED INDEX [IX_TicketInvitations_InvitedUserProviderKey_TicketId] ON [dbo].[TicketInvitations]
    [InvitedUserProviderKey] ASC,
    [TicketId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[Tickets]
    [CustomerId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Tickets]
    [ParentId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[Tickets]
    [ServiceId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceMailboxId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceMailboxId] ON [dbo].[Tickets]
    [ServiceMailboxId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_SolverFullName] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_SolverFullName] ON [dbo].[Tickets]
    [SolverFullName] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_SolverKey] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_SolverKey] ON [dbo].[Tickets]
    [SolverKey] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_SubmitterFullName] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_SubmitterFullName] ON [dbo].[Tickets]
    [SubmitterFullName] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_SubmitterKey] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_SubmitterKey] ON [dbo].[Tickets]
    [SubmitterKey] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_Tickets_TicketType_TicketTypeIdREF] Script Date: 7.5.2014 8:39:38 ******/
    CREATE UNIQUE NONCLUSTERED INDEX [IX_Tickets_TicketType_TicketTypeIdREF] ON [dbo].[Tickets]
    [TicketType] ASC,
    [TicketTypeIdREF] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    ALTER TABLE [dbo].[CustomerUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
    REFERENCES [dbo].[Customers] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[CustomerUsers] CHECK CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId]
    GO
    ALTER TABLE [dbo].[InternalGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId] FOREIGN KEY([InternalGroupId])
    REFERENCES [dbo].[InternalGroups] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[InternalGroupUsers] CHECK CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId]
    GO
    ALTER TABLE [dbo].[OperatorGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
    REFERENCES [dbo].[OperatorGroups] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[OperatorGroupUsers] CHECK CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId]
    GO
    ALTER TABLE [dbo].[ServiceDeputyManagers] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
    REFERENCES [dbo].[Services] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[ServiceDeputyManagers] CHECK CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId]
    GO
    ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
    REFERENCES [dbo].[OperatorGroups] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId]
    GO
    ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
    REFERENCES [dbo].[Services] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId]
    GO
    ALTER TABLE [dbo].[ServiceOperators] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
    REFERENCES [dbo].[Services] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[ServiceOperators] CHECK CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId]
    GO
    ALTER TABLE [dbo].[Services] WITH CHECK ADD CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId] FOREIGN KEY([ParentId])
    REFERENCES [dbo].[Services] ([Id])
    GO
    ALTER TABLE [dbo].[Services] CHECK CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId]
    GO
    ALTER TABLE [dbo].[TicketInvitations] WITH CHECK ADD CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId] FOREIGN KEY([TicketId])
    REFERENCES [dbo].[Tickets] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[TicketInvitations] CHECK CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId]
    GO
    ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
    REFERENCES [dbo].[Customers] ([Id])
    GO
    ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId]
    GO
    ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId] FOREIGN KEY([ServiceMailboxId])
    REFERENCES [dbo].[ServiceMailboxes] ([Id])
    GO
    ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId]
    GO
    ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
    REFERENCES [dbo].[Services] ([Id])
    GO
    ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId]
    GO
    ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId] FOREIGN KEY([ParentId])
    REFERENCES [dbo].[Tickets] ([Id])
    GO
    ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId]
    GO

  • SQL Performance issue: Using user defined function with group by

    Hi Everyone,
    im new here and I really could need some help on a weird performance issue. I hope this is the right topic for SQL performance issues.
    Well ok, i create a function for converting a date from timezone GMT to a specified timzeone.
    CREATE OR REPLACE FUNCTION I3S_REP_1.fnc_user_rep_date_to_local (date_in IN date, tz_name_in IN VARCHAR2) RETURN date
    IS
    tz_name VARCHAR2(100);
    date_out date;
    BEGIN
    SELECT
    to_date(to_char(cast(from_tz(cast( date_in AS TIMESTAMP),'GMT')AT
    TIME ZONE (tz_name_in) AS DATE),'dd-mm-yyyy hh24:mi:ss'),'dd-mm-yyyy hh24:mi:ss')
    INTO date_out
    FROM dual;
    RETURN date_out;
    END fnc_user_rep_date_to_local;The following statement is just an example, the real statement is much more complex. So I select some date values from a table and aggregate a little.
    select
    stp_end_stamp,
    count(*) noi
    from step
    where
    stp_end_stamp
    BETWEEN
    to_date('23-05-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')      
    AND
    to_date('23-07-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')
    group by
    stp_end_stampThis statement selects ~70000 rows and needs ~ 70ms
    If i use the function it selects the same number of rows ;-) and takes ~ 4 sec ...
    select
    fnc_user_rep_date_to_local(stp_end_stamp,'Europe/Berlin'),
    count(*) noi
    from step
    where
    stp_end_stamp
    BETWEEN
    to_date('23-05-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')      
    AND
    to_date('23-07-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')
    group by
    fnc_user_rep_date_to_local(stp_end_stamp,'Europe/Berlin')I understand that the DB has to execute the function for each row.
    But if I execute the following statement, it takes only ~90ms ...
    select
    fnc_user_rep_date_to_gmt(stp_end_stamp,'Europe/Berlin','ny21654'),
    noi
    from
    select
    stp_end_stamp,
    count(*) noi
    from step
    where
    stp_end_stamp
    BETWEEN
    to_date('23-05-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')      
    AND
    to_date('23-07-2009 00:00:00','dd-mm-yyyy hh24:mi:ss')
    group by
    stp_end_stamp
    )The execution plan for all three statements is EXACTLY the same!!!
    Usually i would say, that I use the third statement and the world is in order. BUT I'm working on a BI project with a tool called Business Objects and it generates SQL, so my hands are bound and I can't make this tool to generate the SQL as a subselect.
    My questions are:
    Why is the second statement sooo much slower than the third?
    and
    Howcan I force the optimizer to do whatever he is doing to make the third statement so fast?
    I would really appreciate some help on this really weird issue.
    Thanks in advance,
    Andi

    Hi,
    The execution plan for all three statements is EXACTLY the same!!!Not exactly. Plans are the same - true. They uses slightly different approach to call function. See:
    drop table t cascade constraints purge;
    create table t as select mod(rownum,10) id, cast('x' as char(500)) pad from dual connect by level <= 10000;
    exec dbms_stats.gather_table_stats(user, 't');
    create or replace function test_fnc(p_int number) return number is
    begin
        return trunc(p_int);
    end;
    explain plan for select id from t group by id;
    select * from table(dbms_xplan.display(null,null,'advanced'));
    explain plan for select test_fnc(id) from t group by test_fnc(id);
    select * from table(dbms_xplan.display(null,null,'advanced'));
    explain plan for select test_fnc(id) from (select id from t group by id);
    select * from table(dbms_xplan.display(null,null,'advanced'));Output:
    PLAN_TABLE_OUTPUT
    Plan hash value: 47235625
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   1 |  HASH GROUP BY     |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   2 |   TABLE ACCESS FULL| T    | 10000 | 30000 |   159   (1)| 00:00:02 |
    Query Block Name / Object Alias (identified by operation id):
       1 - SEL$1
       2 - SEL$1 / T@SEL$1
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$1" "T"@"SEL$1")
          OUTLINE_LEAF(@"SEL$1")
          ALL_ROWS
          OPTIMIZER_FEATURES_ENABLE('10.2.0.4')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
    Column Projection Information (identified by operation id):
       1 - (#keys=1) "ID"[NUMBER,22]
       2 - "ID"[NUMBER,22]
    34 rows selected.
    SQL>
    Explained.
    SQL>
    PLAN_TABLE_OUTPUT
    Plan hash value: 47235625
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   1 |  HASH GROUP BY     |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   2 |   TABLE ACCESS FULL| T    | 10000 | 30000 |   159   (1)| 00:00:02 |
    Query Block Name / Object Alias (identified by operation id):
       1 - SEL$1
       2 - SEL$1 / T@SEL$1
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$1" "T"@"SEL$1")
          OUTLINE_LEAF(@"SEL$1")
          ALL_ROWS
          OPTIMIZER_FEATURES_ENABLE('10.2.0.4')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
    Column Projection Information (identified by operation id):
       1 - (#keys=1) "TEST_FNC"("ID")[22]
       2 - "ID"[NUMBER,22]
    34 rows selected.
    SQL>
    Explained.
    SQL> select * from table(dbms_xplan.display(null,null,'advanced'));
    PLAN_TABLE_OUTPUT
    Plan hash value: 47235625
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   1 |  HASH GROUP BY     |      |    10 |    30 |   162   (3)| 00:00:02 |
    |   2 |   TABLE ACCESS FULL| T    | 10000 | 30000 |   159   (1)| 00:00:02 |
    Query Block Name / Object Alias (identified by operation id):
       1 - SEL$F5BB74E1
       2 - SEL$F5BB74E1 / T@SEL$2
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$F5BB74E1" "T"@"SEL$2")
          OUTLINE(@"SEL$2")
          OUTLINE(@"SEL$1")
          MERGE(@"SEL$2")
          OUTLINE_LEAF(@"SEL$F5BB74E1")
          ALL_ROWS
          OPTIMIZER_FEATURES_ENABLE('10.2.0.4')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
    Column Projection Information (identified by operation id):
       1 - (#keys=1) "ID"[NUMBER,22]
       2 - "ID"[NUMBER,22]
    37 rows selected.

  • Performance issue while wrapping the sql in pl/sql block

    Hi All,
    I am facing performance issue in a query while wrapping the sql in pl/sql block.
    I have a complex view. while quering the view using
    Select * from v_csp_tabs(Name of View I am using), it is taking 10 second to fetch 50,000 records.
    But when I am using some conditions on the view, Like
    Select * from v_csp_tabs where clientid = 500006 and programid = 1 and vendorid = 1, it is taking more then 250 secs. to return the result set.
    now the weird part is this is happening only for one programID, that is 1
    I am using Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    Any one please suggest what are the things i need to check..
    I am sorry, I could not provide you the explain plan, because this is in production and I do not have enough prevelage.
    Thank you in advance.
    Thnx,
    Bits

    Bits wrote:
    I have a complex view. while quering the view using
    Select * from v_csp_tabs(Name of View I am using), it is taking 10 second to fetch 50,000 records.
    But when I am using some conditions on the view, Like
    Select * from v_csp_tabs where clientid = 500006 and programid = 1 and vendorid = 1, it is taking more then 250 secs. to return the result set.That's one problem with views - you never know how they will be used in the future, nor what performance implications variant uses can have.
    >
    now the weird part is this is happening only for one programID, that is 1
    Any one please suggest what are the things i need to check..
    I am sorry, I could not provide you the explain plan, because this is in production and I do not have enough prevelage.I understand what you are saying - I have worked at similar sites. HiddenName is correct in suggesting that you need to get execution plans but sometimes getting privileges from the DBA group is simply Not Going To Happen. Its wrong but that's the way it is. Follow through on HiddenName's suggested to get help from somebody who has the privleges needed
    Post the query that view view is executing. Desk checking a query is NOT ideal but is one thing we can do.
    I don't suppose you can see V$ views on production - V$SQL and V$SQL_PLAN (probably not if you can't generate plans, but its worth a thought)

  • SQL Services 2012 Reporting Services Performance Issue - PowerView

    Power view Reports are loading very slow while opening in SharePoint 2013, it is taking more than 15 secs. It is development environment, maximum 10 users , no traffic at all but still not sure why it is taking such long time.
    We have 2 servers in SharePoint farm one is for SharePoint and other is for SQL. I have gone through the logs in reporting database, attached the same below. Can you please help me what we can say from the sheet attached ,whether it is slow or fast. Or where
    we are having issue.
    SQL server version is SQL 2012 SP2.
    SharePoint 2013 is RTM.
    Gone through the below blogs but no luck.
    http://blogs.msdn.com/b/psssql/archive/2013/07/29/tracking-down-power-view-performance-problems.aspx
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4ed01ff4-139a-4eb3-9e2e-df12a9c316ff/ssrs-2008-r2-and-sharepoint-2010-performance-problems
    Thanks.
    Thanks, Ram Ch

    Hi Ram Ch,
    According to your description, your have performance issue when running your Power View report. Right?
    In this scenario, based on your screenshot, it takes long time on data retrieval. How is the performance when executing the query in SQL Server Management Studio? Since you mention there's no traffic at all and 15 seconds will not cause query
    time out, we suggest you optimize the query for retrieving data. Please refer to links below:
    Troubleshooting Reports: Report Performance
    Please share some detail information about the data query if possible. Thanks.
    Best Regards,
    Simon Hou

  • Performance issues of SQL access to AW

    Hi Experts:
    I wonder whether there is performance issues when using SQL to access AW. When using SQL to access cubes in AW, the SQL queries the relational views for AW objects. And the views are based on OLAP_TABLE function. We know that, views based on any table function are not able to make use of index. That is to query a subset of the data of a view, we would have to full scan the view and then apply the filter. Such query plan always lead to bad performance.
    I want to know, when I use SQL to retrieve a small part of data in an AW-cube, will Oracle OLAP engine retrieve all data in the cube and then apply the filter? If the Oracle OLAP engine only retrieves data needed from AW, how can she did it?
    Thanks.

    For most requests the OLAP_TABLE function can reduce the amount of data it produces by examining the rowsource tree , or WHERE clause. The data in Oracle OLAP is highly indexed. There are steps a user can take to optimize the index use. Specifically, pin down the dimension(s) defined in the OLAP_TABLE function LIMITMAP via (NOT)IN lists on the dimension, parent, level or GID columns. Use of valuesets for the INHIER object, instead of a boolean object.
    In 10g, WHERE clauses like SALES > 50 are also processed prior to sending data out.
    For large requests (thousands of rows) performance can be a problem because the data is being sent through the object layer. In 10 this can be ameliorated by wrapping the OLAP_TABLE function call with a SQL MODEL clause. The SQL MODEL knows a bit more about the Olap options and does not require use to pipe the data through the object layer.
    SQL MODEL example (note no ADT defintion, using of auto ADT) This can be wrapped in a CREATE VIEW statement :
    select * from olap_table('myaw duration session', null, null, 'measure sales as number from aw_sales_obj dimension d1 as varchar2(10) from geog ...rest of dimensions')
    sql model dimension by (d1, d2, d3, d4) measures (sales, any attributes, parent columns etc...) unique single reference rules update sequential order ()
    Example of WHERE clause with above select.
    SELECT *
    FROM (select * from olap_table('myaw duration session', null, null, 'measure sales as number from aw_sales_obj dimension d1 as varchar2(10) from geog ...rest of dimensions')
    sql model dimension by (d1, d2, d3, d4) measures (sales, any attributes, parent columns etc...) unique single reference rules update sequential order ()))
    WHERE GEOG NOT IN ('USA', 'CANADA')
    and GEOG_GID = 1
    and TIME_PARENT IN ('2004')
    and CHANNEL = 'CATALOG'
    and SALES > 50000;

Maybe you are looking for