SQL Azure very slow
Hi Experts
We have SQL Azure database that is running very slow, so i took a backup of the database and restored on my on premise sql server express edition.
I tried a update statement on a logs tables that have approximately about 1,062,367 records.
UPDATE logs set FileId = NULL
where LEN(FileId) < 36
The above update statement updates about 910,593 records on localhost host in 20 sec and if i run the same updates statement on SQL Azure it took 40mins and 16sec. The update statement was issues using SQL Server management studio installed on my local machine.
With reference to internet connection, we have fiber connection with download speed of 70.62mbps and upload speed of 84.09mbps
I am not sure whats going wrong with SQL Azure database i.e. could there be a specific fault on my database at Microsoft side etc.
Any advice or suggestion will be highly appreciated.
Kind Regards
Bhavesh
Bhavesh
I have waited for 40 min for the update to complete and it has successfully and updated logs table so i can't re-run the update statement again because there will be no records to update.
I have managed to find another example that took about 10 mins to complete on the SSMS but when ran the same query on the azure management portal it took only 6 secs which puzzled me.
Here is the query:
select
l.Value3 as ClientReference,
l.[Key] as ActivityUser,
l.Value2 as FormDisplayName,
l.Value6 as Status,
l.DateStamp as LastUpdated,
l.[Action] as FileDescription,
l.CompanyId as ClientID,
l.FileId as FileID,
f.id
from Logs l
LEFT OUTER JOIN files f on f.Id = l.FileId
where l.AccountId = 578
and type = 1
The above query returns about 3694 records only.
Here is the details of the query performance
Azure Management Portal
Duration(ms): 6487
CPU(ms): 2443
Logical Reads: 74729
Physical Reads: 66147
Logical Writes: 0
SSMS
Duration(ms): 615259
CPU(ms): 3666
Logical Reads: 74729
Physical Reads: 71370
Logical Writes: 0
Any update will be appreciated.
Bhavesh
Similar Messages
-
Joomla website running from Azure very slow
I have migrated a Joomla website to windows Azure and it is running really slow (despite being a temp URL with only me connecting to it) compared to the previous hosting. The site is scaled up to standard with 2 CPUs and runs from a free cleardb
MySQL database (as created by the Azure Joomla wizard). I have tried everything (following guides on speeding up Joomla) to speed it up but nothing works. I am suspicious of the free cleardb database connection and raised a support question with them but they
were useless.
Is Microsoft's flagship Azure hosting really this bad? Has anyone else had problems with speed (particularly if connecting to a cleardb SQL database)?
My test URL is: http://rmjoomla.azurewebsites.netThanks Brenton,
That's interesting that it is responsive on the US. Apparently the website and database are hosted in Northern Europe (Dublin for Azure and not sure where database is exactly) and I am based in UK. I have checked it across different connections but
it just seems slow (sometimes 10s plus to load a page). The only thing I haven't tried is upgrading the database but since I am the only connection I am not convinced this will help.
There may be another option you need to check... Make sure the Website is AlwaysOn.. and Azure doesn't tear down the website due to inactivity.
https://social.msdn.microsoft.com/Forums/azure/en-US/5c822101-98ab-460d-94c9-d1ebb555d549/azure-website-very-slow-performance-nz?forum=windowsazurewebsitespreview
Entrepreneur, Strategic Technical Advisor, and Sr. Consulting Engineer - Strategic Services and Solutions Check out my book - Powershell 3.0 - WMI: http://amzn.to/1BnjOmo | Mastering PowerShell Coming in April 2015! -
I have a table which has 40million data in it. Of-course partitioned!.
begin
pk_cm_entity_context.set_entity_in_context(1);
end;
SELECT COUNT(1) FROM XFACE_ADDL_DETAILS_TXNLOG;
alter table XFACE_ADDL_DETAILS_TXNLOG rename to XFACE_ADDLDTS_TXNLOG_PTPART;
SELECT COUNT(1) FROM XFACE_ADDLDTS_TXNLOG_PTPART;
-- Create table
create table XFACE_ADDL_DETAILS_TXNLOG
REF_TXN_NO CHAR(40),
REF_USR_NO CHAR(40),
REF_KEY_NO VARCHAR2(50),
REF_TXN_NO_ORG CHAR(40),
REF_USR_NO_ORG CHAR(40),
RECON_CODE VARCHAR2(25),
COD_TASK_DERIVED VARCHAR2(5),
COD_CHNL_ID VARCHAR2(6),
COD_SERVICE_ID VARCHAR2(10),
COD_USER_ID VARCHAR2(30),
COD_AUTH_ID VARCHAR2(30),
COD_ACCT_NO CHAR(22),
TYP_ACCT_NO VARCHAR2(4),
COD_SUB_ACCT_NO CHAR(16),
COD_DEP_NO NUMBER(5),
AMOUNT NUMBER(15,2),
COD_CCY VARCHAR2(3),
DAT_POST DATE,
DAT_VALUE DATE,
TXT_TXN_NARRATIVE VARCHAR2(60),
DATE_CHEQUE_ISSUE DATE,
TXN_BUSINESS_TYPE VARCHAR2(10),
CARD_NO CHAR(20),
INVENTORY_CODE CHAR(10),
INVENTORY_NO CHAR(20),
CARD_PASSBOOK_NO CHAR(30),
COD_CASH_ANALYSIS CHAR(20),
BANK_INFORMATION_NO CHAR(8),
BATCH_NO CHAR(10),
SUMMARY VARCHAR2(60),
MAIN_IC_TYPE CHAR(1),
MAIN_IC_NO CHAR(48),
MAIN_IC_NAME CHAR(64),
MAIN_IC_CHECK_RETURN_CODE CHAR(1),
DEPUTY_IC_TYPE CHAR(1),
DEPUTY_IC_NO CHAR(48),
DEPUTY_NAME CHAR(64),
DEPUTY_IC_CHECK_RETURN_CODE CHAR(1),
ACCOUNT_PROPERTY CHAR(4),
CHEQUE_NO CHAR(20),
COD_EXT_TASK CHAR(10),
COD_MODULE CHAR(4),
ACC_PURPOSE_CODE VARCHAR2(15),
NATIONALITY CHAR(3),
CUSTOMER_NAME CHAR(192),
COD_INCOME_EXPENSE CHAR(6),
COD_EXT_BRANCH CHAR(6),
COD_ACCT_TITLE CHAR(192),
FLG_CA_TT CHAR(1),
DAT_EXT_LOCAL DATE,
ACCT_OWNER_VALID_RESULT CHAR(1),
FLG_DR_CR CHAR(1),
FLG_ONLINE_UPLOAD CHAR(1),
FLG_STMT_DISPLAY CHAR(1),
COD_TXN_TYPE NUMBER(1),
DAT_TS_TXN TIMESTAMP(6),
LC_BG_GUARANTEE_NO VARCHAR2(20),
COD_OTHER_ACCT_NO CHAR(22),
COD_MOD_OTHER_ACCT_NO CHAR(4),
COD_CC_BRN_SUB_ACCT NUMBER(5),
COD_CC_BRN_OTHR_ACCT NUMBER(5),
COD_ENTITY_VPD NUMBER(5) default NVL(sys_context('CLIENTCONTEXT','entity_code'),11),
COD_EXT_TASK_REV VARCHAR2(10)
partition by hash (REF_TXN_NO)
PARTITIONS 128
store in (FCHDATA1,FCHDATA2,FCHDATA3,FCHDATA4, FCHDATA5, FCHDATA6, FCHDATA7, FCHDATA8);
insert /*+APPEND NOLOGGING */ into XFACE_ADDL_DETAILS_TXNLOG
select /*+PARALLEL */ * from XFACE_ADDLDTS_TXNLOG_PTPART;
-- Add comments to the table
comment on table XFACE_ADDL_DETAILS_TXNLOG
is ' Additional Data log table ';
-- Add comments to the columns
comment on column XFACE_ADDL_DETAILS_TXNLOG.REF_TXN_NO
is 'Transaction Reference Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.REF_USR_NO
is 'User Reference Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.REF_KEY_NO
is 'Unique key to identify a leg of the transaction';
comment on column XFACE_ADDL_DETAILS_TXNLOG.REF_TXN_NO_ORG
is 'Original Transaction Reference Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.REF_USR_NO_ORG
is 'Original Transaction User Reference Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.RECON_CODE
is 'Reconciliation of transactions in future';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_TASK_DERIVED
is 'Transaction mnemonic for the request';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_CHNL_ID
is 'Channel ID';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_SERVICE_ID
is 'Service ID';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_USER_ID
is 'User ID';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_AUTH_ID
is 'Authorizer ID';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_ACCT_NO
is 'It can be Card number or MCA or GL or CASH GL';
comment on column XFACE_ADDL_DETAILS_TXNLOG.TYP_ACCT_NO
is 'Type of input (Valid values CARD, MCA, GL, CASH, LN)';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_SUB_ACCT_NO
is 'MC Sub Account Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_DEP_NO
is 'Deposit Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.AMOUNT
is 'Transaction Amount';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_CCY
is 'Currency Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.DAT_POST
is 'Posting Date of the transaction';
comment on column XFACE_ADDL_DETAILS_TXNLOG.DAT_VALUE
is 'Value Date of the transaction';
comment on column XFACE_ADDL_DETAILS_TXNLOG.TXT_TXN_NARRATIVE
is 'Text Transaction Narrative';
comment on column XFACE_ADDL_DETAILS_TXNLOG.DATE_CHEQUE_ISSUE
is 'Date of Issue of Cheque';
comment on column XFACE_ADDL_DETAILS_TXNLOG.TXN_BUSINESS_TYPE
is 'Transaction Business Type';
comment on column XFACE_ADDL_DETAILS_TXNLOG.CARD_NO
is 'Card Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.INVENTORY_CODE
is 'Inventory Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.INVENTORY_NO
is 'Inventory Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.CARD_PASSBOOK_NO
is 'Card Passbook Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_CASH_ANALYSIS
is 'Cash Analysis Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.BANK_INFORMATION_NO
is 'Bank Information Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.BATCH_NO
is 'Batch Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.SUMMARY
is 'Summary';
comment on column XFACE_ADDL_DETAILS_TXNLOG.MAIN_IC_TYPE
is 'IC Type';
comment on column XFACE_ADDL_DETAILS_TXNLOG.MAIN_IC_NO
is 'IC Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.MAIN_IC_NAME
is 'IC Name';
comment on column XFACE_ADDL_DETAILS_TXNLOG.MAIN_IC_CHECK_RETURN_CODE
is 'IC Check Return Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.DEPUTY_IC_TYPE
is 'Deputy IC Type';
comment on column XFACE_ADDL_DETAILS_TXNLOG.DEPUTY_IC_NO
is 'Deputy IC Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.DEPUTY_NAME
is 'Deputy Name';
comment on column XFACE_ADDL_DETAILS_TXNLOG.DEPUTY_IC_CHECK_RETURN_CODE
is 'Deputy IC Check Return Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.ACCOUNT_PROPERTY
is 'Account Property';
comment on column XFACE_ADDL_DETAILS_TXNLOG.CHEQUE_NO
is 'Cheque Number';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_EXT_TASK
is 'External Task Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_MODULE
is 'Module Code - CH, TD, RD , LN, CASH, GL';
comment on column XFACE_ADDL_DETAILS_TXNLOG.ACC_PURPOSE_CODE
is 'Account Purpose Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.NATIONALITY
is 'Nationality';
comment on column XFACE_ADDL_DETAILS_TXNLOG.CUSTOMER_NAME
is 'Customer Name';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_INCOME_EXPENSE
is 'Income Expense Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_EXT_BRANCH
is 'External Branch Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_ACCT_TITLE
is 'Account Title Code';
comment on column XFACE_ADDL_DETAILS_TXNLOG.FLG_CA_TT
is 'Cash or Funds Transfer flag';
comment on column XFACE_ADDL_DETAILS_TXNLOG.DAT_EXT_LOCAL
is 'Local Date';
comment on column XFACE_ADDL_DETAILS_TXNLOG.ACCT_OWNER_VALID_RESULT
is 'Account Owner Valid Result';
comment on column XFACE_ADDL_DETAILS_TXNLOG.FLG_DR_CR
is 'Flag Debit Credit - D, C.';
comment on column XFACE_ADDL_DETAILS_TXNLOG.FLG_ONLINE_UPLOAD
is 'Flag Online Upload - O, U.';
comment on column XFACE_ADDL_DETAILS_TXNLOG.FLG_STMT_DISPLAY
is 'Statement Display Flag - Y/N, Y(Normal Reversal), N(Correction Reversal)';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_TXN_TYPE
is 'To denote the kind of transaction:
1 ?Cash Credit Transaction
2 ?Cash Debit Transaction
3 ?Funds Transfer Credit Transaction
4 ?Funds Transfer Debit Transaction
comment on column XFACE_ADDL_DETAILS_TXNLOG.DAT_TS_TXN
is 'Date and Timestamp of the record being inserted';
comment on column XFACE_ADDL_DETAILS_TXNLOG.LC_BG_GUARANTEE_NO
is 'LC/BG Guarantee Number for which the request for the Liquidation has been initiated.';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_OTHER_ACCT_NO
is 'Other Account No';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_MOD_OTHER_ACCT_NO
is 'Module Code of Other Account No - CH, TD, RD , LN, CASH, GL';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_CC_BRN_SUB_ACCT
is 'Branch Code for Sub Account';
comment on column XFACE_ADDL_DETAILS_TXNLOG.COD_CC_BRN_OTHR_ACCT
is 'Branch Code for Other Account';
-- Create/Recreate indexes
drop index IN_XFACE_ADDL_DETAILS_TXNLOG_1;
drop index IN_XFACE_ADDL_DETAILS_TXNLOG_2;
drop index IN_XFACE_ADDL_DETAILS_TXNLOG_3;
drop index IN_XFACE_ADDL_DETAILS_TXNLOG_4;
drop index IN_XFACE_ADDL_DETAILS_TXNLOG_5;
drop index IN_XFACE_ADDL_DETAILS_TXNLOG_6;
drop index IN_XFACE_ADDL_DETAILS_TXNLOG_7;
drop index IN_XFACE_ADDL_DETAILS_TXNLOG_8;
create index IN_XFACE_ADDL_DETAILS_TXNLOG_1 on XFACE_ADDL_DETAILS_TXNLOG (REF_TXN_NO, REF_KEY_NO, COD_SUB_ACCT_NO, COD_ENTITY_VPD)
GLOBAL PARTITION BY HASH (REF_TXN_NO, REF_KEY_NO, COD_SUB_ACCT_NO) PARTITIONS 128 STORE IN (FCHINDX1, FCHINDX2, FCHINDX3, FCHINDX4) PARALLEL (DEGREE 32) NOLOGGING;
create index IN_XFACE_ADDL_DETAILS_TXNLOG_2 on XFACE_ADDL_DETAILS_TXNLOG (REF_USR_NO, REF_KEY_NO, COD_SUB_ACCT_NO, COD_ENTITY_VPD)
GLOBAL PARTITION BY HASH(REF_USR_NO, REF_KEY_NO, COD_SUB_ACCT_NO) PARTITIONS 128 STORE IN (FCHINDX1, FCHINDX2, FCHINDX3, FCHINDX4) PARALLEL (DEGREE 32) NOLOGGING;
create index IN_XFACE_ADDL_DETAILS_TXNLOG_3 on XFACE_ADDL_DETAILS_TXNLOG (COD_SUB_ACCT_NO, FLG_STMT_DISPLAY,DAT_POST COD_ENTITY_VPD)
GLOBAL PARTITION BY HASH(COD_SUB_ACCT_NO, FLG_STMT_DISPLAY) PARTITIONS 128 STORE IN (FCHINDX1, FCHINDX2, FCHINDX3, FCHINDX4) PARALLEL (DEGREE 32) NOLOGGING;
create index IN_XFACE_ADDL_DETAILS_TXNLOG_4 on
XFACE_ADDL_DETAILS_TXNLOG (COD_ACCT_NO, REF_TXN_NO, COD_TXN_TYPE, COD_USER_ID, COD_EXT_BRANCH, COD_ENTITY_VPD)
GLOBAL PARTITION BY HASH(COD_ACCT_NO, REF_TXN_NO, COD_TXN_TYPE, COD_USER_ID, COD_EXT_BRANCH)
PARTITIONS 128 STORE IN (FCHINDX1, FCHINDX2, FCHINDX3, FCHINDX4) PARALLEL (DEGREE 32) NOLOGGING;
create index IN_XFACE_ADDL_DETAILS_TXNLOG_5 on XFACE_ADDL_DETAILS_TXNLOG (COD_USER_ID, DAT_POST, COD_ENTITY_VPD)
GLOBAL PARTITION BY HASH(COD_USER_ID) PARTITIONS 128 STORE IN (FCHINDX1, FCHINDX2, FCHINDX3, FCHINDX4) PARALLEL (DEGREE 32) NOLOGGING;
create index IN_XFACE_ADDL_DETAILS_TXNLOG_6 on XFACE_ADDL_DETAILS_TXNLOG (REF_TXN_NO_ORG, COD_ENTITY_VPD)
GLOBAL PARTITION BY HASH(REF_TXN_NO_ORG) PARTITIONS 128 STORE IN (FCHINDX1, FCHINDX2, FCHINDX3, FCHINDX4) PARALLEL (DEGREE 32) NOLOGGING;
create index IN_XFACE_ADDL_DETAILS_TXNLOG_7 on XFACE_ADDL_DETAILS_TXNLOG (DAT_EXT_LOCAL, DAT_POST,TXN_BUSINESS_TYPE, FLG_ONLINE_UPLOAD, COD_CHNL_ID, REF_TXN_NO, COD_ENTITY_VPD)
GLOBAL PARTITION BY HASH(DAT_EXT_LOCAL) PARTITIONS 128 STORE IN (FCHINDX1, FCHINDX2, FCHINDX3, FCHINDX4) PARALLEL (DEGREE 32) NOLOGGING;
/* Previous Key order: (COD_EXT_BRANCH,DAT_POST,REF_TXN_NO_ORG,COD_SERVICE_ID,COD_ENTITY_VPD) */
create index IN_XFACE_ADDL_DETAILS_TXNLOG_8 on XFACE_ADDL_DETAILS_TXNLOG (DAT_POST, COD_EXT_BRANCH, REF_TXN_NO_ORG, COD_SERVICE_ID, COD_ENTITY_VPD)
GLOBAL PARTITION BY HASH(DAT_POST) PARTITIONS 128 STORE IN (FCHINDX1, FCHINDX2, FCHINDX3, FCHINDX4) PARALLEL (DEGREE 32) NOLOGGING;
ALTER TABLE XFACE_ADDL_DETAILS_TXNLOG NOPARALLEL PCTFREE 50 INITRANS 128 LOGGING;
ALTER index IN_XFACE_ADDL_DETAILS_TXNLOG_1 NOPARALLEL INITRANS 128;
ALTER index IN_XFACE_ADDL_DETAILS_TXNLOG_2 NOPARALLEL INITRANS 128;
ALTER index IN_XFACE_ADDL_DETAILS_TXNLOG_3 NOPARALLEL INITRANS 128;
ALTER index IN_XFACE_ADDL_DETAILS_TXNLOG_4 NOPARALLEL INITRANS 128;
ALTER index IN_XFACE_ADDL_DETAILS_TXNLOG_5 NOPARALLEL INITRANS 128;
ALTER index IN_XFACE_ADDL_DETAILS_TXNLOG_6 NOPARALLEL INITRANS 128;
ALTER index IN_XFACE_ADDL_DETAILS_TXNLOG_7 NOPARALLEL INITRANS 128;
ALTER index IN_XFACE_ADDL_DETAILS_TXNLOG_8 NOPARALLEL INITRANS 128;
BEGIN
DBMS_RLS.ADD_POLICY(OBJECT_SCHEMA => UPPER('FCR44HOST'),
OBJECT_NAME => UPPER('XFACE_ADDL_DETAILS_TXNLOG '),
POLICY_NAME => 'FC_ENTITY_POLICY',
FUNCTION_SCHEMA => UPPER('FCR44HOST'),
POLICY_FUNCTION => 'pk_cm_vpd_policy.get_entity_predicate',
STATEMENT_TYPES => 'select,insert,update,delete',
UPDATE_CHECK => TRUE,
ENABLE => TRUE,
STATIC_POLICY => FALSE,
POLICY_TYPE => DBMS_RLS.SHARED_STATIC,
LONG_PREDICATE => FALSE,
SEC_RELEVANT_COLS => NULL,
SEC_RELEVANT_COLS_OPT => NULL);
END;
begin
dbms_stats.gather_table_stats(ownname => 'FCR44HOST',tabname => 'XFACE_ADDL_DETAILS_TXNLOG', cascade=>true,method_opt=>'for all columns size 1',degree => 32, GRANULARITY => 'PARTITION');
end;
Query which takes time.
INSERT INTO xface_addl_dtls_tlog_temp
(ref_txn_no,
ref_usr_no,
ref_key_no,
ref_txn_no_org,
ref_usr_no_org,
recon_code,
cod_task_derived,
cod_chnl_id,
cod_service_id,
cod_user_id,
cod_auth_id,
cod_acct_no,
typ_acct_no,
cod_sub_acct_no,
cod_dep_no,
amount,
cod_ccy,
dat_post,
dat_value,
txt_txn_narrative,
date_cheque_issue,
txn_business_type,
card_no,
inventory_code,
inventory_no,
card_passbook_no,
cod_cash_analysis,
bank_information_no,
batch_no,
summary,
main_ic_type,
main_ic_no,
main_ic_name,
main_ic_check_return_code,
deputy_ic_type,
deputy_ic_no,
deputy_name,
deputy_ic_check_return_code,
account_property,
cheque_no,
cod_ext_task,
cod_module,
acc_purpose_code,
nationality,
customer_name,
cod_income_expense,
cod_ext_branch,
cod_acct_title,
flg_ca_tt,
dat_ext_local,
acct_owner_valid_result,
flg_dr_cr,
flg_online_upload,
flg_stmt_display,
cod_txn_type,
dat_ts_txn,
lc_bg_guarantee_no,
cod_other_acct_no,
cod_mod_other_acct_no,
cod_cc_brn_sub_acct,
cod_cc_brn_othr_acct,
cod_ext_task_rev,
sessionid)
SELECT ref_txn_no,
ref_usr_no,
ref_key_no,
ref_txn_no_org,
ref_usr_no_org,
recon_code,
cod_task_derived,
cod_chnl_id,
cod_service_id,
cod_user_id,
cod_auth_id,
cod_acct_no,
typ_acct_no,
cod_sub_acct_no,
cod_dep_no,
amount,
cod_ccy,
dat_post,
dat_value,
txt_txn_narrative,
date_cheque_issue,
txn_business_type,
card_no,
inventory_code,
inventory_no,
card_passbook_no,
cod_cash_analysis,
bank_information_no,
batch_no,
summary,
main_ic_type,
main_ic_no,
main_ic_name,
main_ic_check_return_code,
deputy_ic_type,
deputy_ic_no,
deputy_name,
deputy_ic_check_return_code,
account_property,
cheque_no,
cod_ext_task,
cod_module,
acc_purpose_code,
nationality,
customer_name,
cod_income_expense,
cod_ext_branch,
cod_acct_title,
flg_ca_tt,
dat_ext_local,
acct_owner_valid_result,
flg_dr_cr,
flg_online_upload,
flg_stmt_display,
cod_txn_type,
dat_ts_txn,
lc_bg_guarantee_no,
cod_other_acct_no,
cod_mod_other_acct_no,
cod_cc_brn_sub_acct,
cod_cc_brn_othr_acct,
cod_ext_task_rev,
var_l_sessionid
FROM xface_addl_details_txnlog
WHERE cod_sub_acct_no = var_pi_cod_acct_no
AND dat_post between var_pi_start_dat AND var_pi_end_dat;
Index referred is in_xface_addl_details_txnlog_3.
First time when i execute the query it takes huge time. but subsequent queries are faster. This is only if i pass same account and criteria again.
Observed that first time it goes for physical reads which takes time. and subsequent runs physical reads are less.....
Request suggestions.....this is account statement inquiry user may have 10000txns in a day as well
Bymistake earlier i raised this in "Oracle -> Text"
Slow inserts due to physical reads every time for fresh account i am passin
They suggested to use bind variable. But as i know, we are already using bind variables to bind account number and start and end date.My Replies below.
Whenever you post provide your 4 digit Oracle version (SELECT * FROM V$VERSION).
Ans :
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production"
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
1. If your question is about the INSERT query into xface_addl_dtls_tlog_temp why didn't you post any information about the DDL for that table? Is it the same structure as the table you did post DDL for?
Ans :
-- Create table
create global temporary table XFACE_ADDL_DTLS_TLOG_TEMP
REF_TXN_NO CHAR(40) not null,
REF_USR_NO CHAR(40) not null,
REF_KEY_NO VARCHAR2(50),
REF_TXN_NO_ORG CHAR(40),
REF_USR_NO_ORG CHAR(40),
RECON_CODE VARCHAR2(25),
COD_TASK_DERIVED VARCHAR2(5),
COD_CHNL_ID VARCHAR2(6),
COD_SERVICE_ID VARCHAR2(10),
COD_USER_ID VARCHAR2(30),
COD_AUTH_ID VARCHAR2(30),
COD_ACCT_NO CHAR(22),
TYP_ACCT_NO VARCHAR2(4),
COD_SUB_ACCT_NO CHAR(16),
COD_DEP_NO NUMBER(5),
AMOUNT NUMBER(15,2),
COD_CCY VARCHAR2(3),
DAT_POST DATE,
DAT_VALUE DATE,
TXT_TXN_NARRATIVE VARCHAR2(60),
DATE_CHEQUE_ISSUE DATE,
TXN_BUSINESS_TYPE VARCHAR2(10),
CARD_NO CHAR(20),
INVENTORY_CODE CHAR(10),
INVENTORY_NO CHAR(20),
CARD_PASSBOOK_NO CHAR(30),
COD_CASH_ANALYSIS CHAR(20),
BANK_INFORMATION_NO CHAR(8),
BATCH_NO CHAR(10),
SUMMARY VARCHAR2(60),
MAIN_IC_TYPE CHAR(1),
MAIN_IC_NO VARCHAR2(150),
MAIN_IC_NAME VARCHAR2(192),
MAIN_IC_CHECK_RETURN_CODE CHAR(1),
DEPUTY_IC_TYPE CHAR(1),
DEPUTY_IC_NO VARCHAR2(150),
DEPUTY_NAME VARCHAR2(192),
DEPUTY_IC_CHECK_RETURN_CODE CHAR(1),
ACCOUNT_PROPERTY CHAR(4),
CHEQUE_NO CHAR(20),
COD_EXT_TASK CHAR(10),
COD_MODULE CHAR(4),
ACC_PURPOSE_CODE VARCHAR2(15),
NATIONALITY CHAR(3),
CUSTOMER_NAME CHAR(192),
COD_INCOME_EXPENSE CHAR(6),
COD_EXT_BRANCH CHAR(6),
COD_ACCT_TITLE VARCHAR2(360),
FLG_CA_TT CHAR(1),
DAT_EXT_LOCAL DATE,
ACCT_OWNER_VALID_RESULT CHAR(1),
FLG_DR_CR CHAR(1),
FLG_ONLINE_UPLOAD CHAR(1),
FLG_STMT_DISPLAY CHAR(1),
COD_TXN_TYPE NUMBER(1),
DAT_TS_TXN TIMESTAMP(6),
LC_BG_GUARANTEE_NO VARCHAR2(20),
COD_OTHER_ACCT_NO CHAR(22),
COD_MOD_OTHER_ACCT_NO CHAR(4),
COD_CC_BRN_SUB_ACCT NUMBER(5),
COD_CC_BRN_OTHR_ACCT NUMBER(5),
COD_EXT_TASK_REV VARCHAR2(10),
SESSIONID NUMBER default USERENV('SESSIONID') not null
on commit delete rows;
-- Create/Recreate indexes
create index IN_XFACE_ADDL_DTLS_TLOG_TEMP on XFACE_ADDL_DTLS_TLOG_TEMP (COD_SUB_ACCT_NO, REF_TXN_NO, COD_SERVICE_ID, REF_KEY_NO, SESSIONID);
2. Why doesn't your INSERT query use APPEND, NOLOGGING and PARALLEL like the first query you posted? If those help for the first query why didn't you try them for the query you are now having problems with?
Ans :
I will try to use append but i cannot use parallel since i have hardware limitations.
3. What does this mean: 'Index referred is in_xface_addl_details_txnlog_3.'? You haven't posted any plan that refers to any index. Do you have an execution plan? Why didn't you post it?
Ans :
Plan hash value: 4081844790
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | INSERT STATEMENT | | | | 5 (100)| | | |
| 1 | LOAD TABLE CONVENTIONAL | | | | | | | |
| 2 | FILTER | | | | | | | |
| 3 | PARTITION HASH ALL | | 1 | 494 | 5 (0)| 00:00:01 | 1 | 128 |
| 4 | TABLE ACCESS BY GLOBAL INDEX ROWID| XFACE_ADDL_DETAILS_TXNLOG | 1 | 494 | 5 (0)| 00:00:01 | ROWID | ROWID |
| 5 | INDEX RANGE SCAN | IN_XFACE_ADDL_DETAILS_TXNLOG_3 | 1 | | 3 (0)| 00:00:01 | 1 | 128 |
4. Why are you defining 37 columns as CHAR datatypes? Are you aware that CHAR data REQUIRES the use of the designated number of BYTES/CHARACTERS?
Ans :
I understand and appreciate your points, but since it is huge application and is built over a period of time. I am afraid if i will be allowed to do change on datatypes. there are lot of queries over this table.
5. Are you aware that #4 means those 37 columns columns, even if all of them are NULL, mean that your MINIMUM record length is 1012? Care to guess how many of those records Oracle can fit into an 8k block? And that is if you ignore the other 26 VARCHAR2, NUMBER and DATE columns.
Two of your columns take 192 bytes MINIMUM even if they are null
CUSTOMER_NAME CHAR(192),
COD_ACCT_TITLE CHAR(192)
Why are you wasting all of that space? If you are using a multi-byte character set and your data is multi-byte those 37 columns are using even more space because some characters will use more than one byte.
If the name and title average 30 characters/bytes then those two columns alone use 300+ unused bytes. With 40 million records those unused bytes, just for those two columns take 12 GB of space.
WIth a block size of 8k that would totally waste 1.5 million blocks that Oracle has to read just to ignore the empty space that isn't being used.
I highly suspect that your use of CHAR is a large part of this performance problem and probably other performance problems in your system. Not only for this table but for any other table that uses similar CHAR datatypes and wastes space.
Please reconsider your use of CHAR datatypes like this. I can't imagine what justification you have for using them.
Ans :
I understand your points, but since it is huge application is built over a period of time. I am afraid if i will be allowed to do change on datatypes.
I have to manage in current situation. Not expecting query to respond in millisecs but not even 40secs which is happening currently.
Edited by: Rohit Jadhav on Dec 30, 2012 6:44 PM -
SQL query very slow on Data warehouse
Guys,
Is there any soul who is an expert on SQL ? I do run this query agaist a 2 table and a view which has 30 million rows. Unfortunately the table is partitioned but not the Unique index.
This query takes about 3 hours to run. Is there anyway of writing this in a better way ??
select
a.xcm_consumer_pk,
b.p_vin_prtn_c,
b.vin_type_c,
b.vin_id_c,
b.cveh_owner_cycle_r,
b.veh_reg_no_c,
b.veh_make_c,
b.veh_model_c,
b.veh_deriv_c,
b.veh_reg_y,
b.cveh_link_start_y,
b.cveh_prd_rpl_y,
b.cveh_sl_dlr_c,
c.cu26_address_x
from
xcm_cu01_customer a, xcm_cv01_cons_veh b,
xcm_view_cons_latest_e_mail c
where
a.country_iso3_c = 'GBR'
and (a.cust_brand_c in ('F','Y'))
and a.xcm_consumer_pk = b.xcm_consumer_pk(+)
and b.cveh_owner_cycle_r(+) = 1
and b.cveh_link_end_y(+) between SYSDATE and '31-Dec-9999'
and a.xcm_consumer_pk = c.xcm_consumer_pk(+)
The definition of the view xcm_view_cons_latest_e_mail is as below.
SELECT
A.xcm_consumer_pk,
A.cu26_type_c,
A.p_update_s,
A.cu26_address_x
FROM XCM_CU26_E_MAIL A
WHERE TO_CHAR(NVL(A.p_update_s, '01-Jan-0001'), 'YYYYMMDD') || NVL(A.cu26_type_c, ' ') =
(SELECT MAX(TO_CHAR(NVL(b.p_update_s, '01-Jan-0001'), 'YYYYMMDD') || NVL(b.cu26_type_c, ' '))
FROM XCM_CU26_E_MAIL b
WHERE A.xcm_consumer_pk = b.xcm_consumer_pk);
Most of our query uses the same format and ver 9.2.0.2 has totally screwed up our job times.. Any idea please ??In addition to Maurice's questions:
Are you sure you really need the outer joins?
From your statement "... and ver 9.2.0.2 has totally screwed up our job times" I assume that you have recently upgraded. So:
Are you sure that all relevant indexes exist on the new version?
Have you analyzed all the tables involved since the upgrade?
Are you sure that the init parameters are set appropriately? Note that depending on what version you upgraded from, you may need to make substantial changes to various parameters to get optimal performance.
John -
Sql Query
SELECT DISTINCT '13ck0823ba', ' ', b.emplid,
NVL ((SELECT SUM (b3.total_gross)
FROM sysadm.ps_pay_calendar a3,
sysadm.ps_pay_check b3
WHERE a3.run_id = a.run_id
AND b3.emplid = b.emplid
AND b3.company = b.company
AND b3.paygroup = b.paygroup
AND b3.pay_end_dt = b.pay_end_dt
AND a3.company = b.company
AND a3.paygroup = b.paygroup
AND a3.pay_end_dt = b.pay_end_dt),
0
0,
NVL ((SELECT SUM (b1.lbr_dist_amt)
FROM sysadm.ps_py_ldtl_tbl a1,
sysadm.ps_tl_payable_time b1
WHERE a1.run_id = a.run_id
AND b1.emplid = b.emplid
AND a1.pay_system = b1.pay_system
AND a1.payroll_req_num = b1.payroll_req_num),
0
) AS tl_pay_amt,
0,
NVL ((SELECT /*+ USE_NL(B2 C2) */
SUM (c2.oi_foreign_amt)
FROM sysadm.ps_py_ldtl_tbl a2,
sysadm.ps_tl_payable_time b2,
sysadm.ps_oi_prj_resource c2
WHERE a2.run_id = a.run_id
AND b2.emplid = b.emplid
AND a2.pay_system = b2.pay_system
AND a2.payroll_req_num = b2.payroll_req_num
AND b2.emplid = c2.emplid
AND ( b2.seq_nbr = c2.seq_nbr
OR b2.seq_nbr = SUBSTR (c2.resource_id, -13, 12)
AND b2.dur = c2.trans_dt
AND c2.analysis_type = 'TLB'),
0
) AS tlb_pay,
0, 0, 0
FROM sysadm.ps_pay_calendar a, sysadm.ps_pay_check b
WHERE a.run_id = '13CK0823BA'
AND a.company = b.company
AND a.paygroup = b.paygroup
AND a.pay_end_dt = b.pay_end_dt;
Explain Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
| 0 | SELECT STATEMENT | | 354 | 18054 | 7 (15)| 00:00:01 | | |
| 1 | SORT AGGREGATE | | 1 | 56 | | | | |
| 2 | NESTED LOOPS | | | | | | | |
| 3 | NESTED LOOPS | | 1 | 56 | 4 (0)| 00:00:01 | | |
|* 4 | INDEX RANGE SCAN | PS0PAY_CALENDAR | 1 | 26 | 1 (0)| 00:00:01 | | |
|* 5 | INDEX RANGE SCAN | PS1PAY_CHECK | 1 | | 2 (0)| 00:00:01 | | |
| 6 | TABLE ACCESS BY INDEX ROWID | PS_PAY_CHECK | 1 | 30 | 3 (0)| 00:00:01 | | |
| 7 | SORT AGGREGATE | | 1 | 40 | | | | |
|* 8 | HASH JOIN | | 11 | 440 | 151 (1)| 00:00:02 | | |
|* 9 | INDEX RANGE SCAN | PS0PY_LDTL_TBL | 10 | 190 | 2 (0)| 00:00:01 | | |
| 10 | TABLE ACCESS BY INDEX ROWID | PS_TL_PAYABLE_TIME | 953 | 20013 | 148 (0)| 00:00:02 | | |
|* 11 | INDEX RANGE SCAN | IDX$$_49B90004 | 953 | | 5 (0)| 00:00:01 | | |
| 12 | SORT AGGREGATE | | 1 | 118 | | | | |
| 13 | NESTED LOOPS | | 1 | 118 | 79 (0)| 00:00:01 | | |
| 14 | NESTED LOOPS | | 1 | 99 | 78 (0)| 00:00:01 | | |
| 15 | REMOTE | PS_PROJ_RESOURCE | 18 | 1206 | 6 (0)| 00:00:01 | FSLINK | R->S |
|* 16 | TABLE ACCESS BY INDEX ROWID| PS_TL_PAYABLE_TIME | 1 | 32 | 4 (0)| 00:00:01 | | |
|* 17 | INDEX RANGE SCAN | IDX$$_49B90004 | 1 | | 3 (0)| 00:00:01 | | |
|* 18 | INDEX RANGE SCAN | PS0PY_LDTL_TBL | 1 | 19 | 1 (0)| 00:00:01 | | |
| 19 | HASH UNIQUE | | 354 | 18054 | 7 (15)| 00:00:01 | | |
| 20 | NESTED LOOPS | | 354 | 18054 | 6 (0)| 00:00:01 | | |
|* 21 | INDEX RANGE SCAN | PS0PAY_CALENDAR | 3 | 78 | 2 (0)| 00:00:01 | | |
|* 22 | INDEX RANGE SCAN | PSEPAY_CHECK | 103 | 2575 | 2 (0)| 00:00:01 | | |
Predicate Information (identified by operation id):
4 - access("A3"."RUN_ID"=:B1 AND "A3"."COMPANY"=:B2 AND "A3"."PAYGROUP"=:B3 AND "A3"."PAY_END_DT"=:B4)
5 - access("B3"."EMPLID"=:B1 AND "B3"."COMPANY"=:B2 AND "B3"."PAYGROUP"=:B3 AND "B3"."PAY_END_DT"=:B4)
8 - access("A1"."PAY_SYSTEM"="B1"."PAY_SYSTEM" AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("PAYROLL_REQ_NUM"))="B1
"."PAYROLL_REQ_NUM" AND SYS_OP_DESCEND("PAYROLL_REQ_NUM")=SYS_OP_DESCEND("B1"."PAYROLL_REQ_NUM"))
9 - access("A1"."RUN_ID"=:B1)
11 - access("B1"."EMPLID"=:B1)
16 - filter(("B2"."SEQ_NBR"="SEQ_NBR" OR "B2"."SEQ_NBR"=TO_NUMBER(SUBSTR("RESOURCE_ID",-13,12))) AND
"B2"."DUR"="TRANS_DT")
17 - access("B2"."EMPLID"="EMPLID")
filter("B2"."EMPLID"=:B1)
18 - access("A2"."RUN_ID"=:B1 AND "A2"."PAY_SYSTEM"="B2"."PAY_SYSTEM" AND
SYS_OP_DESCEND("PAYROLL_REQ_NUM")=SYS_OP_DESCEND("B2"."PAYROLL_REQ_NUM"))
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("PAYROLL_REQ_NUM"))="B2"."PAYROLL_REQ_NUM")
21 - access("A"."RUN_ID"='13CK0823BA')
22 - access("A"."COMPANY"="B"."COMPANY" AND "A"."PAYGROUP"="B"."PAYGROUP" AND
"A"."PAY_END_DT"="B"."PAY_END_DT")
Remote SQL Information (identified by operation id):
15 - SELECT /*+ USE_NL ("PS_PROJ_RESOURCE") */ "RESOURCE_ID","ANALYSIS_TYPE","TRANS_DT","FOREIGN_AMOUNT","E
MPLID","SEQ_NBR" FROM "SYSADM"."PS_PROJ_RESOURCE" "PS_PROJ_RESOURCE" WHERE "EMPLID"=:1 AND
"ANALYSIS_TYPE"='TLB' (accessing 'FSLINK' )
57 rows selected.Kindly find the actual plan.
SQL Monitoring Report
SQL Text
SELECT /* sqlt_s31029 */ DISTINCT '13ck0823ba' , ' ' , B.EMPLID , NVL(( SELECT SUM(B3.TOTAL_GROSS) FROM SYSADM.PS_PAY_CALENDAR A3 , SYSADM.PS_PAY_CHECK B3 WHERE A3.RUN_ID = A.RUN_ID AND B3.EMPLID = B.EMPLID AND B3.COMPANY = B.COMPANY AND B3.PAYGROUP = B.PAYGROUP AND B3.PAY_END_DT = B.PAY_END_DT AND A3.COMPANY = B.COMPANY AND A3.PAYGROUP = B.PAYGROUP AND A3.PAY_END_DT = B.PAY_END_DT ),0), 0, NVL( ( SELECT SUM(B1.LBR_DIST_AMT) FROM SYSADM.PS_PY_LDTL_TBL A1 , SYSADM.PS_TL_PAYABLE_TIME B1 WHERE
A1.RUN_ID = A.RUN_ID AND B1.EMPLID = B.EMPLID AND A1.PAY_SYSTEM = B1.PAY_SYSTEM AND A1.PAYROLL_REQ_NUM = B1.PAYROLL_REQ_NUM ),0)AS TL_PAY_AMT, 0, NVL( ( SELECT /*+ USE_NL(B2 C2) */ SUM(C2.OI_FOREIGN_AMT) FROM SYSADM.PS_PY_LDTL_TBL A2 , SYSADM.PS_TL_PAYABLE_TIME B2 , SYSADM.PS_OI_PRJ_RESOURCE C2 WHERE A2.RUN_ID = A.RUN_ID AND B2.EMPLID = B.EMPLID AND A2.PAY_SYSTEM = B2.PAY_SYSTEM AND A2.PAYROLL_REQ_NUM = B2.PAYROLL_REQ_NUM AND B2.EMPLID = C2.EMPLID AND ( B2.SEQ_NBR = C2.SEQ_NBR OR B2.SEQ_NBR =
SUBSTR( C2.RESOURCE_ID,-13,12)) AND B2.DUR = C2.TRANS_DT AND C2.ANALYSIS_TYPE = 'TLB' ),0) AS TLB_PAY,0,0,0 FROM SYSADM.PS_PAY_CALENDAR A, SYSADM.PS_PAY_CHECK B WHERE A.RUN_ID = '13CK0823BA' AND A.COMPANY = B.COMPANY AND A.PAYGROUP = B.PAYGROUP AND A.PAY_END_DT = B.PAY_END_DT
Global Information
Status : DONE (ALL ROWS)
Instance ID : 1
Session : SYS (594:719)
SQL ID : 7kw0g9wd8456b
SQL Execution ID : 16777216
Execution Started : 09/18/2013 03:35:47
First Refresh Time : 09/18/2013 03:36:02
Last Refresh Time : 09/18/2013 07:04:57
Duration : 12550s
Module/Action : sqltxadmin.sqlt$a (xecute)/31029 41 ALTER SESSION SET EVENT
Service : SYS$USERS
Program : [email protected] (TNS V1-V3
Fetch Calls : 143
Global Stats
====================================================================================================
| Elapsed | Cpu | IO | Concurrency | Cluster | Other | Fetch | Buffer | Read | Read |
| Time(s) | Time(s) | Waits(s) | Waits(s) | Waits(s) | Waits(s) | Calls | Gets | Reqs | Bytes |
====================================================================================================
| 12550 | 6451 | 1079 | 0.01 | 2.61 | 5018 | 143 | 2G | 206K | 2GB |
====================================================================================================
SQL Plan Monitoring Details (Plan Hash Value=298818496)
================================================================================================================================================================================================
| Id | Operation | Name | Rows | Cost | Time | Start | Execs | Rows | Read | Read | Mem | Activity | Activity Detail |
| | | | (Estim) | | Active(s) | Active | | (Actual) | Reqs | Bytes | (Max) | (%) | (# samples) |
================================================================================================================================================================================================
| 0 | SELECT STATEMENT | | | | 12536 | +15 | 2125 | 2125 | | | | | |
| 1 | SORT AGGREGATE | | 1 | | 12536 | +15 | 2125 | 2125 | | | | | |
| 2 | NESTED LOOPS | | | | 12536 | +15 | 2125 | 2163 | | | | | |
| 3 | NESTED LOOPS | | 1 | 4 | 12536 | +15 | 2125 | 2163 | | | | | |
| 4 | INDEX RANGE SCAN | PS0PAY_CALENDAR | 1 | 1 | 12536 | +15 | 2125 | 2125 | | | | | |
| 5 | INDEX RANGE SCAN | PS1PAY_CHECK | 1 | 2 | 12536 | +15 | 2125 | 2163 | 1575 | 12MB | | 0.01 | db file sequential read (1) |
| 6 | TABLE ACCESS BY INDEX ROWID | PS_PAY_CHECK | 1 | 3 | 12536 | +15 | 2163 | 2163 | 78 | 624KB | | | |
| 7 | SORT AGGREGATE | | 1 | | 12536 | +15 | 2124 | 2124 | | | | | |
| 8 | HASH JOIN | | 11 | 151 | 12536 | +15 | 2124 | 29600 | | | 1M | | |
| 9 | INDEX RANGE SCAN | PS0PY_LDTL_TBL | 10 | 2 | 12536 | +15 | 2124 | 70092 | | | | | |
| 10 | TABLE ACCESS BY INDEX ROWID | PS_TL_PAYABLE_TIME | 953 | 148 | 12550 | +1 | 2124 | 3M | 192K | 1GB | | 0.90 | Cpu (2) |
| | | | | | | | | | | | | | db file sequential read (111) |
| 11 | INDEX RANGE SCAN | IDX$$_49B90004 | 953 | 5 | 12551 | +0 | 2124 | 3M | 11273 | 88MB | | 0.06 | db file sequential read (8) |
| 12 | SORT AGGREGATE | | 1 | | 12536 | +15 | 2124 | 2124 | | | | | |
| 13 | NESTED LOOPS | | 1 | 79 | 12536 | +15 | 2124 | 33990 | | | | | |
| 14 | NESTED LOOPS | | 1 | 78 | 12536 | +15 | 2124 | 3M | | | | | |
| 15 | REMOTE | PS_PROJ_RESOURCE | 18 | 6 | 12547 | +4 | 2124 | 3M | | | | 4.13 | Cpu (1) |
| | | | | | | | | | | | | | SQL*Net message from dblink (58) |
| | | | | | | | | | | | | | SQL*Net more data from dblink (459) |
| 16 | TABLE ACCESS BY INDEX ROWID | PS_TL_PAYABLE_TIME | 1 | 4 | 12539 | +12 | 3M | 3M | | | | 2.14 | Cpu (268) |
| 17 | INDEX RANGE SCAN | IDX$$_49B90004 | 1 | 3 | 12536 | +15 | 3M | 4G | | | | 0.48 | Cpu (60) |
| 18 | INDEX RANGE SCAN | PS0PY_LDTL_TBL | 1 | 1 | 12536 | +15 | 3M | 33990 | | | | 0.01 | Cpu (1) |
| 19 | HASH UNIQUE | | 354 | 7 | 12536 | +15 | 1 | 2117 | | | 1M | | |
| 20 | NESTED LOOPS | | 354 | 6 | 12536 | +15 | 1 | 2147 | | | | | |
| 21 | INDEX RANGE SCAN | PS0PAY_CALENDAR | 3 | 2 | 12536 | +15 | 1 | 7 | | | | | |
| 22 | INDEX RANGE SCAN | PSEPAY_CHECK | 103 | 2 | 12536 | +15 | 7 | 2147 | 70 | 560KB | | | |
================================================================================================================================================================================================ -
Performance is too slow on SQL Azure box
Hi,
Performance is too slow on SQL Azure box (Located in Europe)
Below query returns 500,000 rows in 18 Min. on SQL Azure box (connected via SSMS, located in India)
SELECT * FROM TABLE_1
Whereas, on local server it returns 500,000 rows in (30 sec.)
SQL Azure configuration:
Service Tier/Performance Level : Premium/P1
DTU : 100
MAX DB Size : 500GB
Max Worker Threads : 200
Max Sessions : 2400
Benchmark Transaction Rate : 105 transactions per second
Predictability : Best
Any suggestion would be highly appreciated.
Thanks,Hello,
Can you please explain in a little more detail the scenario you testing? Are you comparing a SQL Database in Europe against a SQL Database in India? Or a SQL Database with a local, on-premise SQL Server installation?
In case of the first scenario, the roundtrip latency for the connection to the datacenter might play a role.
If you are comparing to a local installation, please note that you might be running against completely different hardware specifications and without network delay, resulting in very different results.
In both cases you can use the below blog post to assess the resource utilization of the SQL Database during the operation:
http://azure.microsoft.com/blog/2014/09/11/azure-sql-database-introduces-new-near-real-time-performance-metrics/
If the DB utilizes up to 100% you might have to consider to upgrade to a higher performance level to achieve the throughput you are looking for.
Thanks,
Jan -
Report region runs very slow, but its sql runs fast
We have a page with a report region Type :SQL Query (plsq function body returning sql query) which runs very slow, pegging the tach on our db box for almost a minute before returning report rows. However, if we run the generated sql from sql plus, it returns all the rows in under 10 seconds with nary a blip on the box. Any idas how what could be causing this or how to debug?
Thanks,
SteveOK, here is the bad boy, shortly after our code that returns the data.
declare
rc__ number;
simple_list__ owa_util.vc_arr;
complex_list__ owa_util.vc_arr;
begin
owa.init_cgi_env(:n__,:nm__,:v__);
htp.HTBUF_LEN := 63;
null;
null;
simple_list__(1) := 'sys.%';
simple_list__(2) := 'dbms\_%';
simple_list__(3) := 'utl\_%';
simple_list__(4) := 'owa\_%';
simple_list__(5) := 'owa.%';
simple_list__(6) := 'htp.%';
simple_list__(7) := 'htf.%';
simple_list__(8) := 'wpg_docload.%';
if ((owa_match.match_pattern(p_string =>
'f'
/* */,p_simple_pattern =>
simple_list__
,p_complex_pattern =>
complex_list__
,p_use_special_chars =>
false)))
then
rc__ := 2;
else
null;
null;
f(p=>:p);
if (wpg_docload.is_file_download) then
rc__ := 1;
wpg_docload.get_download_file(:doc_info);
null;
null;
null;
commit;
else
rc__ := 0;
null;
null;
null;
commit;
owa.get_page(:data__,:ndata__);
end if;
end if;
:rc__ := rc__;
end;
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 25.53 26.59 4492 20992 60 1
Fetch 0 0.00 0.00 0 0 0 0
total 1 25.53 26.59 4492 20992 60 1 -
Slow site, latency between cloud service and SQL Azure?
We have a web site that works pretty swiftly in a local development environment. But once deployed to Azure it slows down to a crawl (even for a single user). Some pages take 30-60 seconds to load. Even the simplest pages take between 5 and 10 seconds.
The app is rather data intensive, so the way I see it, there is a slow connection between the cloud service and the SQL node. We currently use S2 instance, the S1 and S0 didn't work at all because of timeouts. When we execute queries directly against the database,
they all return within milliseconds, so it is not a query performance issue. It seems that there is a big penalty on establishing the connection between the web node and SQL node.
I am not sure if this is a provisioning issue. At times it actually begins to work a bit faster. Not quite as fast in a local environment, but barely acceptable. But then it goes back to excruciatingly slow. Any advice is appreciated.Hi Mimo,
Is this a 5-20second load time something that occurs every time you load the page or just on the first time you load it (cold start)? The default website settings might tear down your site after a period of inactivity and I'm wondering
if that might be what's causing the performance issues.
Couple of things you might want to check :
- Increase the Instance count
- Check the Monitor Tab in Azure Website to see how much of CPU, DataIN and Data Out time is taken for a request to the site.
Recommend you to see this thread discussion on Failed request tracing
for troubleshooting on Slow requests and a video on
Troubleshooting Slow Requests with Failed Request Tracing that might help troubleshoot the slowness of website.
Regards,
Shirisha Paderu -
SQL apply is very slow on Logical Standby..!!
Hello all,
We are having Data Guard setup in our environment where we are having Primary, Physical Standby as well as logical standby databases..
DB Version : 10.2.0.1 in all databases (Pri, Phy and Logical)
OS : RHEL4
Only Oracle is running on this Box..
Since last month we are facing problems in Logical Standby database where it seems SQL apply has become very slow..
Archive log files are successfully transferring from Primary but since SQL apply has become slow logical standby is lagging behind primary by two days..
How do i speed up this SQL apply..?? Any ideas and suggestions are most welcome..
I checked TOP command to find out which oracle processes are consuming maximum CPU and i have found ora_p000_oracle, ora_p001_oracle, ora_p002_oracle, ora_p003_oracle, ora_p004_oracle, ora_p005_oracle, etc processes are consuming highest CPU and Load Average has always been above 1..
Any help would be greatly appreciated..
Thanks - HPHello;
These Oracle notes might help :
Slow Performance In Logical Standby Database Due To Lots Of Activity On Sys.Aud$ [ID 862173.1]
Oracle10g Data Guard SQL Apply Troubleshooting [ID 312434.1]
Developer and DBA Tips to Optimize SQL Apply [ID 603361.1]
Best Regards
mseberg -
SQL Developer is very slow...
I'm having performance issues with Oracle SQL Developer. I tried both and 1.5.4 and 2.1.0 (installed in Windows XP Professional) and both work very slow. When I connect to the same database in Apex or just the webconsole, performance is OK, so I think it's SQL Developer that's slow, not the database.
The problem is that the "Connected To Database..." screen with the "knightrider-bar" appears for some seconds for almost every action I want to perform (retrieving all views, showing constraints, triggers, etc...). Always the waiting screen appears for 3 - 5 seconds, which is very annoying.
Anybody knows what could be the problem? Working through the SQL Console in APEX is much more performant at this moment, but SQL Developer is more handy (if it would work faster).thefurryone wrote:
Tom,
As well as the ide/bin folder, there is a sqldeveloper/bin folder, which has a sqldeveloper.exe as well as the one in the root folder.
Just as another thought - where is SQL Developer installed? Is it local on your PC or on a network drive? Especially when using the version with the included JDK, running off a network drive can be much slower.
theFurryOneOK, found it now. I opened SQLDeveloper there and the console didn't show any messages. When I connect to the database I got this message in the console:
Finished parsing = 15+
UsersCache.fillIn() time = 0 ret==null?: true+
I don't run SQLDeveloper from a network drive, it's installed locally on my C:\ drive. The database however is on a server, but I have a gigabit connection to it and applications don't have performance issues. So I suppose it's actually SQLDeveloper that's slow. Are there any tools in SQLDeveloper that could cause the bad performance, and that I could switch off? -
SQL loader load data very slow...
Hi,
On my production server have issue of insert. Regular SQL loder load file, it take more time for insert the data in database.
First 2 and 3 hours one file take 8 to 10 seconds after that it take 5 minutes.
As per my understanding OS I/O is very slow, First 3 hours DB buffer is free and insert data in buffer normal.
But when buffer is fill then going for buffer waits and then insert is slow on. If it rite please tell me how to increase I/O.
Some analysis share here of My server...................
[root@myserver ~]# iostat
Linux 2.6.18-194.el5 (myserver) 06/01/2012
avg-cpu: %user %nice %system %iowait %steal %idle
3.34 0.00 0.83 6.66 0.00 89.17
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 107.56 2544.64 3140.34 8084953177 9977627424
sda1 0.00 0.65 0.00 2074066 16
sda2 21.57 220.59 1833.98 700856482 5827014296
sda3 0.00 0.00 0.00 12787 5960
sda4 0.00 0.00 0.00 8 0
sda5 0.69 2.75 15.07 8739194 47874000
sda6 0.05 0.00 0.55 5322 1736264
sda7 0.00 0.00 0.00 2915 16
sda8 0.50 9.03 5.24 28695700 16642584
sda9 0.51 0.36 24.81 1128290 78829224
sda10 0.52 0.00 5.98 9965 19004088
sda11 83.71 2311.26 1254.71 7343426336 3986520976
[root@myserver ~]# hdparm -tT /dev/sda11
/dev/sda11:
Timing cached reads: 10708 MB in 2.00 seconds = 5359.23 MB/sec
Timing buffered disk reads: 540 MB in 3.00 seconds = 179.89 MB/sec
[root@myserver ~]# sar -u -o datafile 1 6
Linux 2.6.18-194.el5 (mca-webreporting2) 06/01/2012
09:57:19 AM CPU %user %nice %system %iowait %steal %idle
09:57:20 AM all 6.97 0.00 1.87 16.31 0.00 74.84
09:57:21 AM all 6.74 0.00 1.25 17.48 0.00 74.53
09:57:22 AM all 7.01 0.00 1.75 16.27 0.00 74.97
09:57:23 AM all 6.75 0.00 1.12 13.88 0.00 78.25
09:57:24 AM all 6.98 0.00 1.37 16.83 0.00 74.81
09:57:25 AM all 6.49 0.00 1.25 14.61 0.00 77.65
Average: all 6.82 0.00 1.44 15.90 0.00 75.84
[root@myserver ~]# sar -u -o datafile 1 6
Linux 2.6.18-194.el5 (mca-webreporting2) 06/01/2012
09:57:19 AM CPU %user %nice %system %iowait %steal %idle
mca-webreporting2;601;2012-05-27 16:30:01 UTC;2.54;1510.94;3581.85;0.00
mca-webreporting2;600;2012-05-27 16:40:01 UTC;2.45;1442.78;3883.47;0.04
mca-webreporting2;599;2012-05-27 16:50:01 UTC;2.44;1466.72;3893.10;0.04
mca-webreporting2;600;2012-05-27 17:00:01 UTC;2.30;1394.43;3546.26;0.00
mca-webreporting2;600;2012-05-27 17:10:01 UTC;3.15;1529.72;3978.27;0.04
mca-webreporting2;601;2012-05-27 17:20:01 UTC;9.83;1268.76;3823.63;0.04
mca-webreporting2;600;2012-05-27 17:30:01 UTC;32.71;1277.93;3495.32;0.00
mca-webreporting2;600;2012-05-27 17:40:01 UTC;1.96;1213.10;3845.75;0.04
mca-webreporting2;600;2012-05-27 17:50:01 UTC;1.89;1247.98;3834.94;0.04
mca-webreporting2;600;2012-05-27 18:00:01 UTC;2.24;1184.72;3486.10;0.00
mca-webreporting2;600;2012-05-27 18:10:01 UTC;18.68;1320.73;4088.14;0.18
mca-webreporting2;600;2012-05-27 18:20:01 UTC;1.82;1137.28;3784.99;0.04
[root@myserver ~]# vmstat
procs -----------memory---------- -swap -----io---- system -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 1 182356 499444 135348 13801492 0 0 3488 247 0 0 5 2 89 4 0
[root@myserver ~]# dstat -D sda
----total-cpu-usage---- dsk/sda -net/total- -paging -system
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
3 1 89 7 0 0|1240k 1544k| 0 0 | 1.9B 1B|2905 6646
8 1 77 14 0 1|4096B 3616k| 433k 2828B| 0 0 |3347 16k
10 2 77 12 0 0| 0 1520k| 466k 1332B| 0 0 |3064 15k
8 2 77 12 0 0| 0 2060k| 395k 1458B| 0 0 |3093 14k
8 1 78 12 0 0| 0 1688k| 428k 1460B| 0 0 |3260 15k
8 1 78 12 0 0| 0 1712k| 461k 1822B| 0 0 |3390 15k
7 1 78 13 0 0|4096B 6372k| 449k 1950B| 0 0 |3322 15k
AWR sheet output
Wait Events
ordered by wait time desc, waits desc (idle events last)
Event Waits %Time -outs Total Wait Time (s) Avg wait (ms) Waits /txn
free buffer waits 1,591,125 99.95 19,814 12 129.53
log file parallel write 31,668 0.00 1,413 45 2.58
buffer busy waits 846 77.07 653 772 0.07
control file parallel write 10,166 0.00 636 63 0.83
log file sync 11,301 0.00 565 50 0.92
write complete waits 218 94.95 208 955 0.02
SQL> select 'free in buffer (NOT_DIRTY)',round((( select count(DIRTY) N_D from v$bh where DIRTY='N')*100)/(select count(*) from v$bh),2)||'%' DIRTY_PERCENT from dual
union
2 3 select 'keep in buffer (YES_DIRTY)',round((( select count(DIRTY) N_D from v$bh where DIRTY='Y')*100)/(select count(*) from v$bh),2)||'%' DIRTY_PERCENT from dual;
'FREEINBUFFER(NOT_DIRTY)' DIRTY_PERCENT
free in buffer (NOT_DIRTY) 10.71%
keep in buffer (YES_DIRTY) 89.29%
Rag....1)
Yah This is partition table and on it Local partition index.
SQL> desc GR_CORE_LOGGING
Name Null? Type
APPLICATIONID VARCHAR2(20)
SERVICEID VARCHAR2(25)
ENTERPRISENAME VARCHAR2(25)
MSISDN VARCHAR2(15)
STATE VARCHAR2(15)
FROMTIME VARCHAR2(25)
TOTIME VARCHAR2(25)
CAMP_ID VARCHAR2(50)
TRANSID VARCHAR2(25)
MSI_INDEX NUMBER
SQL> select index_name,column_name from user_ind_columns where table_name='GR_CORE_LOGGING';
INDEX_NAME
COLUMN_NAME
GR_CORE_LOGGING_IND
MSISDN
2) I was try direct but after that i was drop this table and again create new partition table and create fresh index. but still same issue. -
SQL 2012 DBCC CHECKDB Run Very Slow
Does anyone experience this? SQL 2012 DBCC CHECKDB runs very slow on one of the server. I monitored the server and it seems DBCC CHECKDB does not hit the disk hard enough.
It can read 100 mb per second on of my slower server, but on this particular server, it only read 1 mb per second. I saw parallel processes, but it just not read disk hard enough. I am curious what causes this? There is no user using the server when I run
DBCC command. The full database restore took 3 hours, but DBCC CHECKDB took more than 11 hours. Thanks for any input.
LijunHi,
Have you made the change of 'cost threshold for parallelism'? The default value of this is 5. Increasing the cost threshold for parallelism would cause most of the queries including CHECKDB to not execute parallel and hence will tend to
take time to complete. This could be one of the issue contributing to the CHECKDB slow run.
Also, please check if the antivirus is checking SQL Database files:
http://support.microsoft.com/kb/309422
Here is a good article on CHECKDB time taken to complete.
http://blogs.msdn.com/b/sqlserverstorageengine/archive/2007/01/24/how-long-will-checkdb-take-to-run.aspx
Thanks.
Tracy Cai
TechNet Community Support -
SQL server is Running Very Slow
hi,
I used this following query for finding out how many connection are connected, it is showing that 70 connections,my ram is 16GB, but still my sql server is running very slow. how can i increase my sql server speed. or how can i analyses that.I checked
even when no job was running, but still same speed. I'm using store procedures, SQL jobs no inline queries.
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginamehi,
I used this following query for finding out how many connection are connected, it is showing that 30 connections,my ram is 16GB, but still my sql server is running very slow. how can i increase my sql server speed. or how can i analyses that.I checked
even when no job was running, but still same speed.
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame -
Performance too Slow on SQL Azure box
Hi,
Performance is too slow on SQL Azure box:
Below query returns 500,000 rows in 18 Min. on SQL Azure box (connected via SSMS)
SELECT * FROM TABLE_1
Whereas, on local server it returns 500,000 rows in (30 sec.)
SQL Azure configuration:
Service Tier/Performance Level : Premium/P1
DTU : 100
MAX DB Size : 500GB
Max Worker Threads : 200
Max Sessions : 2400
Benchmark Transaction Rate : 105 transactions per second
Predictability : Best
Thanks,Hello,
Please refer to the following document too:
http://download.microsoft.com/download/D/2/0/D20E1C5F-72EA-4505-9F26-FEF9550EFD44/Performance%20Guidance%20for%20SQL%20Server%20in%20Windows%20Azure%20Virtual%20Machines.docx
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
I am linking my question from Stack Overflow here. The link: http://stackoverflow.com/questions/27943913/sql-azure-query-with-row-number-executes-slow-if-columns-with-nvarchar-of-bi
Appreciate your help!
GorgiHi,
Thanks for posting here.
I suggest you to check this link and optimize your query on sql azure.
http://www.sqlusa.com/articles/query-optimization/
http://sqlblog.com/blogs/paul_white/archive/2011/02/23/Advanced-TSQL-Tuning-Why-Internals-Knowledge-Matters.aspx
Also check this blog which had similar issue.
https://social.msdn.microsoft.com/Forums/en-US/c1da08b4-265d-4ec8-a252-8d7090234e3e/simple-select-query-takes-long-time-to-execute-with-nvarchar-columns?forum=transactsql
Girish Prajwal
Maybe you are looking for
-
Hello , In my program selection-screen is coming from LDB(logical database) and i want my own selection-screen in the top means before LDB selection-screen. Pls solve this ASAP. Thanks.
-
All Firefox versions crash when I open them
I haven't been able to open Firefox at all for several months. I have tried everything that's listed in the support section and none of that applies. I click to open it and two seconds later it crasher and I get a message that says "Firefox had a pro
-
Exporting to word, random capital letters
Hello everyone! Bit of background about the situation: A company needs to edit a PDF file as it is outdated, they tried copying directly from the PDF to word but as there is a lot of layout and info dependent on pictures that failed epicly. They aske
-
BI XI R2 Import to BIAR - BO XI 3.0 import from BIAR file. issue
Hi I am importing My Universe, Desktop Reports, Web Intelligence report from BO XI R2 in to BIAR. And then importing it to BO XI 3.0 using the BIAR file. However import went successfully but on BO XI 3.0 I do not see universes or desktop report that
-
Help! Cannot reinstall Indesign - creative cloud thinks it is still on Mac after deletion!
Hi, I recently installed Creative cloud in order to try out Indesign etc. Unfortunately my start-up disk got full, so I deleted them all. I then went to reinstall them, after telling the creative cloud to use a different file location - on an externa