Querry tunning

hi all,
select  * from aapc.marketo.lead where email='[email protected]'
I have executed above querry it will take 30 sec but i want 4 sec
how will u get please tel me
aapc--db, marketo--schema, lead--view

select  * from aapc.marketo.lead where email='[email protected]'
I have executed above querry it will take 30 sec but i want 4 sec
how will u get please tel me
aapc--db, marketo--schema, lead--view
in execution plan cosntant scan 92% how will u reduce the constant scan
Let me repeat what Vaibhav already said : You cannot tell to sql server that you want output in 4 seconds.
For now, just add a non-clustered index on your table for column email. 
CREATE NONCLUSTERED INDEX IX_aapc_marketo_lead_email
ON aapc.marketo.lead (email);
After adding above, then send us table schema, existing indexes and actual execution plan screenshot. We can look at other aspects then.
liquidloop[at]live[dot]co[dot]uk

Similar Messages

  • Tunning of sql querry

    Hi,
    Here is my actual querry.
    UPDATE MST_DO_APPROVE OUTER SET AUTO_APPROVE_FLAG = 1,AUTO_APPROVE_WINDOW = 7,AUTO_APPROVE_FLAG_SYS=0,
    USE_SYSTEM_LOGIC = 0 ,SYS_LAST_MODIFIED_DATE = SYSDATE WHERE (SCENARIO_ID,ITEM_ID,LOCATION_ID) =
    (SELECT 0,MSTITEM.ITEM_ID,LOCATION_ID FROM MST_LOCATION ,MST_ITEM mstitem WHERE
    (CATEGORY = 'SPARES' OR CATEGORY = 'ACCESSORIES') AND
    LOCATION_CATEGORY in ('RETAIL','DIRECT','INSURANCE','DHRP','PRDC')
    AND LOCATION_ID = OUTER.LOCATION_ID AND
    OUTER.ITEM_ID = mstitem.ITEM_ID AND
    mstitem.SCENARIO_ID = 0 AND
    (is_rp_initialized = '0' or is_rp_initialized is null ) OR (is_bod_initialized = '0' or is_bod_initialized is null ))
    ) and sys_ent_state = 'ACTIVE';
    I tuned it to below querry
    UPDATE MST_DO_APPROVE OUTER SET AUTO_APPROVE_FLAG = 1,AUTO_APPROVE_WINDOW = 7,AUTO_APPROVE_FLAG_SYS=0,
    USE_SYSTEM_LOGIC = 0 ,SYS_LAST_MODIFIED_DATE = SYSDATE WHERE (SCENARIO_ID,ITEM_ID,LOCATION_ID) =
    (SELECT 0,MSTITEM.ITEM_ID,MSTLOCATION.LOCATION_ID FROM (Select scenario_id, item_id, category, IS_BOD_INITIALIZED from mst_item where scenario_id=0 and category in (‘SPARES’,’ACCESSORIES’) ) MSTITEM , (select location_id, location_category, is_rp_initialized from mst_location where LOCATION_CATEGORY in ('RETAIL','DIRECT','INSURANCE','DHRP','PRDC') ) mstlocation
    WHERE
    AND mstlocation.LOCATION_ID = OUTER.LOCATION_ID AND
    OUTER.ITEM_ID = mstitem.ITEM_ID AND
    (mstlocation.is_rp_initialized = '0' or mstlocation.is_rp_initialized is null ) OR (mstitem.is_bod_initialized = '0' or mstitem.is_bod_initialized is null ))
    ) and sys_ent_state = 'ACTIVE';
    Is there any possibilty of still tuning this querry?
    Thanks

    As already said, you should do a little investigation to determine why the update is slower than you expect. Use "explain plan" for that purpose, make sure your statistics are up to date, and compare the number of rows that the cost based optimizer predicts with the actual number of rows that you know.
    You might want to try to update a join. It's just a guess from my part, because you didn't provide any numbers. If this doesn't solve anything, please show us more.
    SQL> create table mst_do_approve
      2  as
      3  select -1 auto_approve_flag
      4       , -1 auto_approve_window
      5       , -1 auto_approve_flag_sys
      6       , -1 use_system_logic
      7       , sysdate - 500 sys_last_modified_date
      8       , 'ACTIVE' sys_ent_state
      9       , 0 scenario_id
    10       , 1 location_id
    11       , 1 item_id
    12    from dual
    13  union all
    14  select -1, -1, -1, -1, sysdate - 600, 'ACTIVE', 0, 2, 2 from dual
    15  /
    Tabel is aangemaakt.
    SQL> create table mst_item
      2  as
      3  select 1 item_id, 0 scenario_id, '0' is_bod_initialized, 'SPARES' category from dual union all
      4  select 2, 0, null, 'ANOTHER CATEGORY' from dual
      5  /
    Tabel is aangemaakt.
    SQL> create table mst_location
      2  as
      3  select 1 location_id, '0' is_rp_initialized, 'RETAIL' location_category from dual union all
      4  select 2, null, 'DIRECT' from dual
      5  /
    Tabel is aangemaakt.
    SQL> alter table mst_item add constraint i_pk primary key (item_id)
      2  /
    Tabel is gewijzigd.
    SQL> alter table mst_location add constraint l_pk primary key (location_id)
      2  /
    Tabel is gewijzigd.
    SQL> UPDATE MST_DO_APPROVE OUTER
      2     SET AUTO_APPROVE_FLAG = 1
      3       , AUTO_APPROVE_WINDOW = 7
      4       , AUTO_APPROVE_FLAG_SYS=0
      5       , USE_SYSTEM_LOGIC = 0
      6       , SYS_LAST_MODIFIED_DATE = SYSDATE
      7   WHERE (SCENARIO_ID,ITEM_ID,LOCATION_ID) =
      8         ( SELECT 0
      9                , MSTITEM.ITEM_ID
    10                , LOCATION_ID
    11             FROM MST_LOCATION
    12                , MST_ITEM mstitem
    13            WHERE (CATEGORY = 'SPARES' OR CATEGORY = 'ACCESSORIES')
    14              AND LOCATION_CATEGORY in ('RETAIL','DIRECT','INSURANCE','DHRP','PRDC')
    15              AND LOCATION_ID = OUTER.LOCATION_ID
    16              AND OUTER.ITEM_ID = mstitem.ITEM_ID
    17              AND mstitem.SCENARIO_ID = 0
    18              AND (  (is_rp_initialized = '0' or is_rp_initialized is null )
    19                  OR (is_bod_initialized = '0' or is_bod_initialized is null )
    20                  )
    21         )
    22     and sys_ent_state = 'ACTIVE'
    23  /
    1 rij is bijgewerkt.
    SQL> select * from mst_do_approve
      2  /
    AUTO_APPROVE_FLAG AUTO_APPROVE_WINDOW AUTO_APPROVE_FLAG_SYS USE_SYSTEM_LOGIC SYS_LAST_M SYS_EN SCENARIO_ID LOCATION_ID    ITEM_ID
                    1                   7                     0                0 16-02-2007 ACTIVE           0           1          1
                   -1                  -1                    -1               -1 26-06-2005 ACTIVE           0           2          2
    2 rijen zijn geselecteerd.
    SQL> rollback
      2  /
    Rollback is voltooid.
    SQL> UPDATE MST_DO_APPROVE OUTER
      2     SET AUTO_APPROVE_FLAG = 1
      3       , AUTO_APPROVE_WINDOW = 7
      4       , AUTO_APPROVE_FLAG_SYS=0
      5       , USE_SYSTEM_LOGIC = 0
      6       , SYS_LAST_MODIFIED_DATE = SYSDATE
      7   WHERE (SCENARIO_ID,ITEM_ID,LOCATION_ID) =
      8         ( SELECT 0
      9                , MSTITEM.ITEM_ID
    10                , MSTLOCATION.LOCATION_ID
    11             FROM ( Select scenario_id
    12                         , item_id
    13                         , category
    14                         , IS_BOD_INITIALIZED
    15                      from mst_item
    16                     where scenario_id=0
    17                       and category in ('SPARES','ACCESSORIES')
    18                  ) MSTITEM
    19                , ( select location_id
    20                         , location_category
    21                         , is_rp_initialized
    22                      from mst_location
    23                     where LOCATION_CATEGORY in ('RETAIL','DIRECT','INSURANCE','DHRP','PRDC')
    24                  ) mstlocation
    25            WHERE mstlocation.LOCATION_ID = OUTER.LOCATION_ID
    26              AND OUTER.ITEM_ID = mstitem.ITEM_ID
    27              AND (  (mstlocation.is_rp_initialized = '0' or mstlocation.is_rp_initialized is null )
    28                  OR (mstitem.is_bod_initialized = '0' or mstitem.is_bod_initialized is null )
    29                  )
    30         )
    31     and sys_ent_state = 'ACTIVE'
    32  /
    1 rij is bijgewerkt.
    SQL> select * from mst_do_approve
      2  /
    AUTO_APPROVE_FLAG AUTO_APPROVE_WINDOW AUTO_APPROVE_FLAG_SYS USE_SYSTEM_LOGIC SYS_LAST_M SYS_EN SCENARIO_ID LOCATION_ID    ITEM_ID
                    1                   7                     0                0 16-02-2007 ACTIVE           0           1          1
                   -1                  -1                    -1               -1 26-06-2005 ACTIVE           0           2          2
    2 rijen zijn geselecteerd.
    SQL> rollback
      2  /
    Rollback is voltooid.
    SQL> update ( select da.auto_approve_flag
      2                , da.auto_approve_window
      3                , da.auto_approve_flag_sys
      4                , da.use_system_logic
      5                , da.sys_last_modified_date
      6                , da.sys_ent_state
      7             from mst_do_approve da
      8                , mst_item i
      9                , mst_location l
    10            where da.location_id = l.location_id
    11              and da.item_id = i.item_id
    12              and l.location_category in ('RETAIL','DIRECT','INSURANCE','DHRP','PRDC')
    13              and i.category in ('SPARES','ACCESSORIES')
    14              and i.scenario_id = 0
    15              and (  nvl(i.is_bod_initialized,'0') = '0'
    16                  or nvl(l.is_rp_initialized,'0') = '0'
    17                  )
    18              and da.sys_ent_state = 'ACTIVE'
    19         )
    20     set auto_approve_flag = 1
    21       , auto_approve_window = 7
    22       , auto_approve_flag_sys = 0
    23       , use_system_logic = 0
    24       , sys_last_modified_date = sysdate
    25   where sys_ent_state = 'ACTIVE'
    26  /
    1 rij is bijgewerkt.
    SQL> select * from mst_do_approve
      2  /
    AUTO_APPROVE_FLAG AUTO_APPROVE_WINDOW AUTO_APPROVE_FLAG_SYS USE_SYSTEM_LOGIC SYS_LAST_M SYS_EN SCENARIO_ID LOCATION_ID    ITEM_ID
                    1                   7                     0                0 16-02-2007 ACTIVE           0           1          1
                   -1                  -1                    -1               -1 26-06-2005 ACTIVE           0           2          2
    2 rijen zijn geselecteerd.
    SQL> explain plan
      2  for
      3  UPDATE MST_DO_APPROVE OUTER
      4     SET AUTO_APPROVE_FLAG = 1
      5       , AUTO_APPROVE_WINDOW = 7
      6       , AUTO_APPROVE_FLAG_SYS=0
      7       , USE_SYSTEM_LOGIC = 0
      8       , SYS_LAST_MODIFIED_DATE = SYSDATE
      9   WHERE (SCENARIO_ID,ITEM_ID,LOCATION_ID) =
    10         ( SELECT 0
    11                , MSTITEM.ITEM_ID
    12                , LOCATION_ID
    13             FROM MST_LOCATION
    14                , MST_ITEM mstitem
    15            WHERE (CATEGORY = 'SPARES' OR CATEGORY = 'ACCESSORIES')
    16              AND LOCATION_CATEGORY in ('RETAIL','DIRECT','INSURANCE','DHRP','PRDC')
    17              AND LOCATION_ID = OUTER.LOCATION_ID
    18              AND OUTER.ITEM_ID = mstitem.ITEM_ID
    19              AND mstitem.SCENARIO_ID = 0
    20              AND (  (is_rp_initialized = '0' or is_rp_initialized is null )
    21                  OR (is_bod_initialized = '0' or is_bod_initialized is null )
    22                  )
    23         )
    24     and sys_ent_state = 'ACTIVE'
    25  /
    Uitleg is gegeven.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    | Id  | Operation                      |  Name           | Rows  | Bytes | Cost  |
    |   0 | UPDATE STATEMENT               |                 |       |       |       |
    |   1 |  UPDATE                        | MST_DO_APPROVE  |       |       |       |
    |*  2 |   FILTER                       |                 |       |       |       |
    |*  3 |    TABLE ACCESS FULL           | MST_DO_APPROVE  |       |       |       |
    |   4 |    NESTED LOOPS                |                 |       |       |       |
    |*  5 |     TABLE ACCESS BY INDEX ROWID| MST_ITEM        |       |       |       |
    |*  6 |      INDEX UNIQUE SCAN         | I_PK            |       |       |       |
    |*  7 |     TABLE ACCESS BY INDEX ROWID| MST_LOCATION    |       |       |       |
    |*  8 |      INDEX UNIQUE SCAN         | L_PK            |       |       |       |
    Predicate Information (identified by operation id):
       2 - filter(("SYS_ALIAS_2"."SCENARIO_ID","SYS_ALIAS_2"."ITEM_ID","SYS_ALIAS_2"."
                  LOCATION_ID")= (SELECT 0,"MSTITEM"."ITEM_ID","MST_LOCATION"."LOCATION_ID" FROM
                  "MST_ITEM" "MSTITEM","MST_LOCATION" "MST_LOCATION" WHERE
                  "MST_LOCATION"."LOCATION_ID"=:B1 AND ("MST_LOCATION"."IS_RP_INITIALIZED"='0' OR
                  "MST_LOCATION"."IS_RP_INITIALIZED" IS NULL OR "MSTITEM"."IS_BOD_INITIALIZED"='0'
                  OR "MSTITEM"."IS_BOD_INITIALIZED" IS NULL) AND
                  ("MST_LOCATION"."LOCATION_CATEGORY"='RETAIL' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='DIRECT' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='INSURANCE' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='DHRP' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='PRDC') AND "MSTITEM"."ITEM_ID"=:B2 AND
                  "MSTITEM"."SCENARIO_ID"=0 AND ("MSTITEM"."CATEGORY"='SPARES' OR
                  "MSTITEM"."CATEGORY"='ACCESSORIES')))
       3 - filter("SYS_ALIAS_2"."SYS_ENT_STATE"='ACTIVE')
       5 - filter("MSTITEM"."SCENARIO_ID"=0 AND ("MSTITEM"."CATEGORY"='SPARES' OR
                  "MSTITEM"."CATEGORY"='ACCESSORIES'))
       6 - access("MSTITEM"."ITEM_ID"=:B1)
       7 - filter(("MST_LOCATION"."IS_RP_INITIALIZED"='0' OR
                  "MST_LOCATION"."IS_RP_INITIALIZED" IS NULL OR "MSTITEM"."IS_BOD_INITIALIZED"='0'
                  OR "MSTITEM"."IS_BOD_INITIALIZED" IS NULL) AND
                  ("MST_LOCATION"."LOCATION_CATEGORY"='RETAIL' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='DIRECT' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='INSURANCE' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='DHRP' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='PRDC'))
       8 - access("MST_LOCATION"."LOCATION_ID"=:B1)
    Note: rule based optimization
    46 rijen zijn geselecteerd.
    SQL> exec dbms_lock.sleep(1)
    PL/SQL-procedure is geslaagd.
    SQL> explain plan
      2  for
      3  UPDATE MST_DO_APPROVE OUTER
      4     SET AUTO_APPROVE_FLAG = 1
      5       , AUTO_APPROVE_WINDOW = 7
      6       , AUTO_APPROVE_FLAG_SYS=0
      7       , USE_SYSTEM_LOGIC = 0
      8       , SYS_LAST_MODIFIED_DATE = SYSDATE
      9   WHERE (SCENARIO_ID,ITEM_ID,LOCATION_ID) =
    10         ( SELECT 0
    11                , MSTITEM.ITEM_ID
    12                , MSTLOCATION.LOCATION_ID
    13             FROM ( Select scenario_id
    14                         , item_id
    15                         , category
    16                         , IS_BOD_INITIALIZED
    17                      from mst_item
    18                     where scenario_id=0
    19                       and category in ('SPARES','ACCESSORIES')
    20                  ) MSTITEM
    21                , ( select location_id
    22                         , location_category
    23                         , is_rp_initialized
    24                      from mst_location
    25                     where LOCATION_CATEGORY in ('RETAIL','DIRECT','INSURANCE','DHRP','PRDC')
    26                  ) mstlocation
    27            WHERE mstlocation.LOCATION_ID = OUTER.LOCATION_ID
    28              AND OUTER.ITEM_ID = mstitem.ITEM_ID
    29              AND (  (mstlocation.is_rp_initialized = '0' or mstlocation.is_rp_initialized is null )
    30                  OR (mstitem.is_bod_initialized = '0' or mstitem.is_bod_initialized is null )
    31                  )
    32         )
    33     and sys_ent_state = 'ACTIVE'
    34  /
    Uitleg is gegeven.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    | Id  | Operation                      |  Name           | Rows  | Bytes | Cost  |
    |   0 | UPDATE STATEMENT               |                 |       |       |       |
    |   1 |  UPDATE                        | MST_DO_APPROVE  |       |       |       |
    |*  2 |   FILTER                       |                 |       |       |       |
    |*  3 |    TABLE ACCESS FULL           | MST_DO_APPROVE  |       |       |       |
    |   4 |    NESTED LOOPS                |                 |       |       |       |
    |*  5 |     TABLE ACCESS BY INDEX ROWID| MST_LOCATION    |       |       |       |
    |*  6 |      INDEX UNIQUE SCAN         | L_PK            |       |       |       |
    |*  7 |     TABLE ACCESS BY INDEX ROWID| MST_ITEM        |       |       |       |
    |*  8 |      INDEX UNIQUE SCAN         | I_PK            |       |       |       |
    Predicate Information (identified by operation id):
       2 - filter(("SYS_ALIAS_2"."SCENARIO_ID","SYS_ALIAS_2"."ITEM_ID","SYS_ALIAS_2"."
                  LOCATION_ID")= (SELECT /*+ */ 0,"MST_ITEM"."ITEM_ID","MST_LOCATION"."LOCATION_ID"
                  FROM "MST_LOCATION" "MST_LOCATION","MST_ITEM" "MST_ITEM" WHERE
                  "MST_ITEM"."ITEM_ID"=:B1 AND ("MST_ITEM"."CATEGORY"='SPARES' OR
                  "MST_ITEM"."CATEGORY"='ACCESSORIES') AND "MST_ITEM"."SCENARIO_ID"=0 AND
                  ("MST_LOCATION"."IS_RP_INITIALIZED"='0' OR "MST_LOCATION"."IS_RP_INITIALIZED" IS
                  NULL OR "MST_ITEM"."IS_BOD_INITIALIZED"='0' OR "MST_ITEM"."IS_BOD_INITIALIZED" IS
                  NULL) AND "MST_LOCATION"."LOCATION_ID"=:B2 AND
                  ("MST_LOCATION"."LOCATION_CATEGORY"='RETAIL' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='DIRECT' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='INSURANCE' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='DHRP' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='PRDC')))
       3 - filter("SYS_ALIAS_2"."SYS_ENT_STATE"='ACTIVE')
       5 - filter("MST_LOCATION"."LOCATION_CATEGORY"='RETAIL' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='DIRECT' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='INSURANCE' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='DHRP' OR
                  "MST_LOCATION"."LOCATION_CATEGORY"='PRDC')
       6 - access("MST_LOCATION"."LOCATION_ID"=:B1)
       7 - filter(("MST_ITEM"."CATEGORY"='SPARES' OR
                  "MST_ITEM"."CATEGORY"='ACCESSORIES') AND "MST_ITEM"."SCENARIO_ID"=0 AND
                  ("MST_LOCATION"."IS_RP_INITIALIZED"='0' OR "MST_LOCATION"."IS_RP_INITIALIZED" IS
                  NULL OR "MST_ITEM"."IS_BOD_INITIALIZED"='0' OR "MST_ITEM"."IS_BOD_INITIALIZED" IS
                  NULL))
       8 - access("MST_ITEM"."ITEM_ID"=:B1)
    Note: rule based optimization
    46 rijen zijn geselecteerd.
    SQL> exec dbms_lock.sleep(1)
    PL/SQL-procedure is geslaagd.
    SQL> explain plan
      2  for
      3  update ( select da.auto_approve_flag
      4                , da.auto_approve_window
      5                , da.auto_approve_flag_sys
      6                , da.use_system_logic
      7                , da.sys_last_modified_date
      8                , da.sys_ent_state
      9             from mst_do_approve da
    10                , mst_item i
    11                , mst_location l
    12            where da.location_id = l.location_id
    13              and da.item_id = i.item_id
    14              and l.location_category in ('RETAIL','DIRECT','INSURANCE','DHRP','PRDC')
    15              and i.category in ('SPARES','ACCESSORIES')
    16              and i.scenario_id = 0
    17              and (  nvl(i.is_bod_initialized,'0') = '0'
    18                  or nvl(l.is_rp_initialized,'0') = '0'
    19                  )
    20              and da.sys_ent_state = 'ACTIVE'
    21         )
    22     set auto_approve_flag = 1
    23       , auto_approve_window = 7
    24       , auto_approve_flag_sys = 0
    25       , use_system_logic = 0
    26       , sys_last_modified_date = sysdate
    27   where sys_ent_state = 'ACTIVE'
    28  /
    Uitleg is gegeven.
    SQL> select * from table(dbms_xplan.display)
      2  /
    PLAN_TABLE_OUTPUT
    | Id  | Operation                      |  Name           | Rows  | Bytes | Cost  |
    |   0 | UPDATE STATEMENT               |                 |       |       |       |
    |   1 |  UPDATE                        | MST_DO_APPROVE  |       |       |       |
    |   2 |   NESTED LOOPS                 |                 |       |       |       |
    |   3 |    NESTED LOOPS                |                 |       |       |       |
    |*  4 |     TABLE ACCESS FULL          | MST_DO_APPROVE  |       |       |       |
    |*  5 |     TABLE ACCESS BY INDEX ROWID| MST_LOCATION    |       |       |       |
    |*  6 |      INDEX UNIQUE SCAN         | L_PK            |       |       |       |
    |*  7 |    TABLE ACCESS BY INDEX ROWID | MST_ITEM        |       |       |       |
    |*  8 |     INDEX UNIQUE SCAN          | I_PK            |       |       |       |
    Predicate Information (identified by operation id):
       4 - filter("DA"."SYS_ENT_STATE"='ACTIVE' AND "DA"."SYS_ENT_STATE"='ACTIVE')
       5 - filter("L"."LOCATION_CATEGORY"='RETAIL' OR
                  "L"."LOCATION_CATEGORY"='DIRECT' OR "L"."LOCATION_CATEGORY"='INSURANCE' OR
                  "L"."LOCATION_CATEGORY"='DHRP' OR "L"."LOCATION_CATEGORY"='PRDC')
       6 - access("DA"."LOCATION_ID"="L"."LOCATION_ID")
       7 - filter((NVL("I"."IS_BOD_INITIALIZED",'0')='0' OR
                  NVL("L"."IS_RP_INITIALIZED",'0')='0') AND "I"."SCENARIO_ID"=0 AND
                  ("I"."CATEGORY"='SPARES' OR "I"."CATEGORY"='ACCESSORIES'))
       8 - access("DA"."ITEM_ID"="I"."ITEM_ID")
    Note: rule based optimization
    29 rijen zijn geselecteerd.Regards,
    Rob.

  • Querry tuning

    Hi, iam trying to tune this querry below, which actually calls for user_id's from some base tables in a schema through an SP.
    BEGIN
    dsfservices.set_user_locale_preferences (2200266);
    END;
    select
    (select long_description from system_codes sc ,account acc where sc.system_code_id = 411 and sc.code_value = acc.account_status and acc.account_id = a.account_id ) account_status
    ,(select display_name from entity_relationship er_sol,entity e where er_sol.entity_b_id = a.account_id and er_sol.relationship_type = 307 and er_sol.reverse_relationship_type = 519 and e.entity_id = er_sol.entity_a_id
    and er_sol.relationship_status = 1) Account_Solution
    ,a.account_id,a.source_system_account_id
    ,(select display_name from entity where entity_id = er.ENTITY_A_ID) Client_Name
    ,(select (select display_name from entity where entity_id = entity_a_id)
    from entity_relationship where relationship_type = 230 and reverse_relationship_type = 229 and relationship_status = 1 and entity_b_id = er.entity_a_id) RM
    ,(select (select display_name from entity where entity_id = entity_a_id)
    from entity_relationship where relationship_type = 617 and reverse_relationship_type = 610 and relationship_status = 1 and entity_b_id = er.entity_a_id and rownum = 1) IA
    ,transvcs_account_pkg. get_acc_port_marketval(2200266, 200001, a.account_id, null, null) ACCNT_MKT_VALUE
    from entity_relationship er
    select * from
    (select acc.source_system_account_id,acc.account_id from account acc where acc.account_status <> 6
    minus
    select * from
    (select distinct acc.source_system_account_id Account_id
    ,account_id account_entityid
    from account acc
    ,(select sse.schd_event_id ,sse.activity_id, act.activity_status,arp.package_name,sse.entity_id,sse.PACKAGE_ID,act.start_dt Activity_date
    from schd_statement_event sse, activity act,ALLOWABLE_RPT_PACKAGE arp
    where sse.activity_id = act.activity_id and act.activity_status <> 4
    and sse.package_id in (2200040,2200041)
    and sse.package_id = arp.package_id ) at
    where acc.account_id = at.entity_id
    and acc.account_status <> 6
    union
    select distinct b.Account_Entity_id,b.Account_Number
    from
    (select schd_event_id,entity_id,package_id,act.activity_id
    ,(select long_description from system_codes where system_code_id = 322 and code_value = act.activity_Status) Event_status
    from schd_statement_event sse,activity act where sse.activity_id = act.activity_id and act.activity_status <> 4
    ) a
    ,(select
    (select display_name from entity where entity_id = er1.Entity_B_Id) STMT_Group_Name
    ,eg.base_currency ACCGROUP_BASE_CURRENCY
    ,er1.Entity_B_Id
    ,p.source_system_portfolio_Id Account_Entity_id
    ,p.parent_portfolio_id Account_Number
    ,p.portfolio_long_name1
    ,(select iso_currency from allowable_currency ac,profile_base pb
    where ac.profile_id = pb.profile_id
    and ac.base_currency_flg = 1
    and pb.entity_id = p.parent_portfolio_id ) ACC_BASE_CURRENCY
    from entity_relationship er1, entity_relationship er3, portfolio p,entity_group eg
    where er1.relationship_type = 258 and er1.reverse_relationship_type =257 and er1.relationship_status = 1
    -- Primary Owner -- Account relationship
    -- Group Container -- Group Member relationship
    and er1.entity_b_id = er3.entity_a_id and er3.relationship_type = 252 and er3.reverse_relationship_type =262 and er3.relationship_status = 1
    and p.portfolio_id = er3.entity_b_id
    and eg.group_id = er1.Entity_B_Id
    order by 1,Account_number) b
    where a.entity_id = Entity_B_Id
    and a.package_id in (2200040,2200041)))
    ) a
    where er.entity_b_id = a.account_id
    and er.relationship_type = 115
    and er.reverse_relationship_type = 145
    and er.relationship_status = 1
    order by 1;
    This querry is taking long time to finish. not only there are number of nested loops, it is also doing a full table scan.
    Any help would be appreciated.

    I would try converting the columns you have as scalar subqueries into in-line views, i.e.,
    Instead of:
    select
    (select long_description from system_codes sc ,account acc where sc.system_code_id = 411 and sc.code_value = acc.account_status and acc.account_id = a.account_id ) account_statusI would have:
    SELECT ilv1.account_status
    FROM
    (SELECT  long_description account_status, acc.account_id FROM system_codes sc ,account acc where sc.system_code_id = 411 and sc.code_value = acc.account_status) ilv1
    JOIN
    (select schd_event_id,entity_id,package_id,act.activity_id
    ,(select long_description from system_codes where system_code_id = 322 and code_value = act.activity_Status) Event_status
    from schd_statement_event sse,activity act where sse.activity_id = act.activity_id and act.activity_status 4
    ) a
    ON ilv1.account_id = a.account_id
    ...That should also allow you to remove the multiple references to the same tables in the same query block.
    Additionally, if the UNION block can't return duplicate rows to the upper block you could change that to a UNION ALL.

  • How can you get your data back on i tunes

    Hi i am Justin,
    I have i phone and i have i tunes here is my problom. last night i formatted my HP windows 7 computer and i backed up my pictures and backed up i tunes witch i thoght i did becasue i backed it up on my external 500 MB hard drive and with out making a folder and c oping i tunes i only backed up library and before the format i went to edit, preferences and adavaned in i tunes (sorry about the bad spelling) becasue apples's step by step i read and saw the pictures were to go and i thought i can back up i tunes that way. My phone has 333 songs all my pictures apps and contacts and there is no way to re copy from the phone back in to i tunes i do not use i cloud becasue (one i do not want to pay for more space) and 2 the free version tells me i do not have enough space to back it up so i am worried one sync i will lose all my info. these songs are from cd's i have and off the Internet before the courts stopped Napster and Lime Wire. Sos what should i do just unstalli tunes and leave my computer as a re charging stastion? or is there any secret way to get all my things back then this time i can make a folder and do it right in case the next time i have to re format my drive from a problems or need to what is the best case here?
    Justin

    Sync is only oneway, from PC to your device. Unless you have the music on your PC, iTunes is going to wipe out what you have on your device if you are syncing to a new library.
    You can only transfer Purchased music over to Itunes on your PC.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    http://support.apple.com/kb/HT1848
    As for you own music, you may have to use a third party software. A good Free one is called Sharepod which you can download from Download.com here:
    http://download.cnet.com/SharePod/3000-2141_4-10794489.html?tag=mncol;2

  • I tunes downloads to wrong drive

    Hi guys some help please. When I download the latest I tunes 9.1.1 is wants to install to drice "G" which I don't have I want it to download on "C". Any ideas?

    Hey there,
    One thing you should check is where your iTunes searches for your iTunes folder. Head to iTunes and then Preferences. When the window pops up, head over to the Advanced tab. Near the top of the tab, you will see where iTunes currently locates your Music folder. Click the Change button and then direct it to where the folder is located on your External drive. See if that helps.
    B-rock

  • My i tunes account for my pc and i phone wont let me update my apps or download any new ones can some one tell me why?

    my i tunes account for both my pc and i phone wont let me update or download any apps.

    no none errors it started after i installed the new ios 5.1 on my i phone i wait ages ans it says cannot conect to the i tunes store. and on the pc when i go to update them it says service timed out after about ten mins of waiting

  • Secure link to I tunes is not working please help

    I have been gaining access to I Tunes fine up to last Wednesday. I now cannot access my account on I tunes, I can surf the shop fine and look at it contents fine but as soon as I try to buy anything I can't log in to my account. I cannot even create a new account.
    I'm in contact with apple via e mail but everything they suggest just isn't working. Does any one have any ideas of what I can try as I'm at a dead end now and I have credit on my account.
    Many Thanks

    I found the solution! My WAN setting on my router was set at 1458 and should have been 1400.

  • I tunes will not open - have read ALOT but still can't get it going

    How much is Apple losong out to what appears to be a fairly common but complicated problem. Not sure if it all started the day I upgraded to i-tunes 9 or when I renewed my Norton Anti Virus. It was working for months even when I had Norton which i have since removed using the Norton Removal Tool. When I first click on it it tries to open and I get a message saying that my Quick Time software is outdated but BEFORE I can click on that another box opens over top that says "i-tunes has stopped working" "a problem has caused the program to stop working correctly. Windows will close he problem and notify you if a solution is found"
    If i try again , nothing happens at all. When I go to processes I can see where it appears briefly maybe 2-3 seconds then disappears.
    I have tried:
    Making another user account and opening I-tunes
    Removing my Norton anti virus
    Uninstalling and re-installing i-tunes and quick time both together and separately....many many times
    restoring previous version of i-tunes
    I get the same message if i try to open just quicktime.
    My i -tunes library itself will also not open.
    Please tell me where to go from here
    I am running a newer (3 months old) HP with Windows 7 64 bit
    IDEAS???
    Rob.

    Excellent news, Rob! Glad you're up and running again.
    Any idea as to how it got this way? I am thinking of re-installing my Norton since it has worked well for me for the last few years and I an not exactly sure if that was the problem or if was a Windows 7 thing?
    I reckon Norton and Windows 7 were innocent parties here. Some other application dumped a couple of boatloads of QuickTime componentry in your sysWOW64. (Older versions of codec packs, video converter software, other file converter software, and media players that offer the opportunity to use quicktime files "without installing QuickTime" are the usual culprits here, but some games might do this too.) That might go unnoticed so long as that componentry matches the existing version of QuickTime software that you have installed on the PC ... but things turn to custard when you have to update your QuickTime version, and the versions of the componentry in /sysWOW64/ no longer match your "QuickTime proper". (On 32-bit systems, the same sort of thing happens, with the difference being that the "foreign" QuickTime componentry would typically be lurking down in the system32 folder.)
    So, we pretty much get cases of this sort of thing showing up constantly at the forums, with a big pulse in reports happening after any QuickTime version update. (It produces a significant proportion of the "iTunes has encountered a problem" and "iTunes has stopped working" messages that we get reported here.) You were really unlucky in that you got a rarer version of the possible error messages ... so there's not as much relevant troubleshooting advice available on the web, which makes researching what could possibly be going wrong for you considerably harder than it is for folk with the more common versions of the error messages.

  • I have 3 iTunes accounts which I had set up each time I bought a device not realising they all linked up (blonde!!). Can I consolidate them into one account without losing tunes,pics etc??

    I have 3 iTunes accounts which I had set up each time I got a new device not realising I should use the same one. Is there a way to consolidate the accounts without losing tunes etc as at the moment my iPad, new iPhone and iPod are all getting different downloads : (

    It's impossible to merge two iTunes accounts

  • How to use one I-tunes library with multiple windows users (family) on 1 pc

    On our family pc we log in with different accounts. We want to use I-Tunes but all have the same library. I tried to create a library not in the users directory, but in the All Users folder that is accessible for everyone. However, when I import the music in the library for one user and set the same location for another user, I-tunes does not recognize the library. So everyone has to create it's own library.
    What are the best practices to overcome this?

    Keep in mind that what you have done now is you have multiple iTunes libraries accessing the same media folder. Meaning, that each account can have their own ratings, playlists, etc. but more importantly, each account does NOT know what the other account does, so if your daughter adds a CD to her account, it will go into the shared folder, but it will NOT automatically go into your wife's iTunes library. She would have to add it manually. Likewise, if one account deletes music from their library and tells iTunes to remove it to the trash, the other accounts will not know and iTunes will still try to access the file from the shared location even though the file is now trashed.
    Each account has their own database files (.itl files in the iTunes folder) which stores this stuff.
    If you want to have everyone use the exact same library which means the same ratings, playlists, etc. then you need to move the database files into that same location and set each iTunes account to read the same data.
    How to open an alternate iTunes Library file or create a new one
    http://docs.info.apple.com/article.html?artnum=304447
    Patrick

  • How to delete the loadings list in the itunes store (1000 tunes are downloading with no reason)

    Hi
    I switched from an iPhone 4 to an iPhone 5c and now the itunes store app wants to download 1000 tunes (I guess it cannot try more) and it blocks.
    I don't know how to delete the list (not one by one of course .
    If someone has any clue to help
    Thanks

    Hi Francis,
    Check the BADI "TRIP_WEB_CHECK" method "USER_CHECK_GENERAL_DATA".
    Here based on the schema you can modify the "estimated cost" field.
    Hope it helps.
    Regards,
    Jyothi

  • My family uses a single lap-top as our main internet connection and when we synch our respective I-pods, our I-tunes account seems to wipe-out our playlists, even though we have tried to create separate I-tune accounts.  Help!!

    My family uses a single lap-top as our home computer and several of us have i-pods that we like to synch, using I-tunes.  Although we've tried to create separate I-tune accounts, our i-tunes playlists are getting wiped out when one of us deletes songs on our I-pod and it seems as though I-tunes is not distinguishing our distinct accounts and all i-pods are being synched to reflect the latest i-pod anyone makes on their respective account.  It appears as though our distinct I-tune accounts are not being loaded on our lap-top when we sign in and unfortunately, when we're in I-tunes, there is nothing to indicate what account is on the screen.  For all the glowing appraisals apple-related products usually receive, we are finding i-tunes and its interface with our respective i-pods to be a very, very frustrating experience. 
    Can anyone shed some light on this for a family of non-techies?  Thx 
    Pegger64  

    You need to create separate Windows user accounts if you want to seperate the behaviour of iTunes for each user. That also means separate iTunes libraries for each user.
    Windows is a multi-user operating system but you are not using it properly. iTunes is not a multi-user application. No application is. You can't expect it to treat different users differently when they are all using the same computer user account.
    Do you understand what I mean?

  • In previous versions of i Tunes you could highlight a song in your library and there would be a genious list on the right side of the screen showing songs like the one highlighted in the library. Now I do not get that list. Is there a way to get this back

    In previous versions of i Tunes I could highlight a song in my library and a genious list would show on the right side of the screen listing songs that were like the one highlighted. Now I do not get that list. Is there a way to get that back?

    Hi again Bob,
    I believe I've found the feature you were speaking about now. Information on the "In the Store" feature of iTunes can be found here:
    Apple - iTunes - Inside iTunes - Using In the Store from within your iTunes Library.
    http://www.apple.com/itunes/inside-itunes/2013/01/using-in-the-store-from-within -your-itunes-library.html
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • Why does Firefox not allow me to access podcasts by clicking on the "view in i-tunes" link from a website?

    When I click on "view in i-tunes," Firefox starts opening multiple tabs at a rate of 4 or 5 per second. The only way to stop it is to turn off the computer & reboot. How can I fix this?

    See this support article. <br />
    https://support.mozilla.com/en-US/kb/Firefox%20keeps%20opening%20many%20tabs%20or%20windows

  • How can I see previously stored tunes no longer on my computer? Where are iCloud audio files?

    Maybe my question has an answer too "obvious" for me to see it.  But lately I've become aware of tunes that, for one reason or another, are not showing in my iMac's iTunes program. I went to System Preferences and clicked on "iCloud."  Immediately, I saw how to check iCloud for the following files and documents: Mail, Contacts, Calendar, Notes, Safari (not sure what this category could be for--seeing what was on the web at some prior point in history?), Photo Stream, Documents & Data, Back to My Mac, Find My Mac.
    In other words, going to iCloud appears to reveal categories for all of your iCloud content EXCEPT your music files.  I know about iTunes Match, and I think I like it, now that I've gotten used to a few of its quirks.  But certainly there are times when the owner of downloaded, commercial audio files (i.e. Tunes) will not have them on his computer.  And certainly there must be a way for me to see what I've previously stored in the Cloud--if only to remind myself of the music I've purchased and have available to me.
    I may be missing something about the whole iCloud concept.  Is there a way for me to see tunes I've previously stored in the iCloud but no longer have on my computer?  (I'm always careful not to delete tunes from my iTunes program unless I see 2 or more identical files appearing on my computer).
    Thanks for any directions to the iCloud musical holdings / archives--or clarification of any misunderstandings.
    Cap
    (I see that I'm currently running OS 10.8.2.  I have only 500 gigs of memory, and my music collection is so larg, I'm almost dependent on being able to access songs in the iCloud.  Next time, I'll certainly pony up for the largest memory Apple offers on an iMac.)

    They are not showing up in Lightroom at all. I already deleted them.
    When I try to import them again into Lightroom it wants to add another 2012 folder to wherever I am trying to insert them and then it does the month/day folder when it already has the month folder it should automatically go into and not be adding a seperate 2012 folder first.
    I can't even get it to do the above right now. Now all it does is it wants to make this seperate 2012 folder with the month/day folders but has little boxes beside each folder showing that there are no images to import. The images do show up on the import screen but they are all darkened and unchecked. When I click the proper folder to import them they come on bright and have little boxes checked, but that lasts for less than a second before it decides they are not new. They are new images, I deleted them all out of Lightroom, and probably missed deleting some through Lightroom but instead deleted them straight from the folder outside of Lightroom. This is what is probably causing me such grief and I have found nothing in my searches to tell me how to correct this. *sigh*

Maybe you are looking for

  • How do I manage three catalogs?

    I have three catalogues; one for my professional pet photos, one for all my personal stuff, and one for stuff that doesn't quite fit into the other two. It seems that when I work in Lightroom, or even Premier Elements, whatever file I may be working

  • How can I change the background color of a menu ring?

    Hi Does anybody know how to change the background color of a menu ring??? (not the backround color of the first item, the background color of the list (remains always gray)) thanks martin

  • How to connect with oracle8/8i in jdbc program

    Dear Pal I am getting problem in connecting Oracle8/8i database , I am registering driver using String dsnName = "jdbc:oracle:thin:@<Server>:<Port>:<DSN-Name>"; DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); but it is giving err

  • XI cache refresh error 'HTTP status code503 Service Unavailable'

    We are running XI 3.0, SP 9 XI cache refresh stopped working today (red traffic light). Tried a Delta refresh. Got a program dump with error 'Access with ‘ZERO’ object reference not possible'. Activated all objects in Change lists of Repository, dire

  • Concept of OOPs ?

    Hi, Thanks to All Java Mem, I like to know the concept of OOP with real time Example. I know the fundamental concept of OOP but I don�t know how can apply with real time. Now I attend the interview most of the interviewer ask the same questions. I ca