Row Insert in Timesten takes more time than Oracle
Hi,
I have a Timesten IMDB (11.2.1.8.0 (64 bit Linux/x86_64) with an underlying Oracle Database 11Gr2.
Sys.odbc.ini entry is :
[DSN_NAME]
Driver=/application/TimesTen/matrix/lib/libtten.so
DataStore=/application/TimesTen/DSN_NAME_datastore/DSN_NAME_DS_DIR
LogDir=/logs_timeten/DSN_NAME_logdir
PermSize=8000
TempSize=250
PLSQL=1
DatabaseCharacterSet=WE8MSWIN1252
OracleNetServiceName=DBNAME
Connections=500
PassThrough=0
SQLQueryTimeout=250
LogBufMB=512
LogFileSize=512
LogPurge=1
When I try to insert a simple row in a table in an asyc cache group in Timesten it takes 3 ms (it has 6 indexes on it). On removing 4 indexes the performance improves to 1 ms. However inserting the same row on Oracle (with 6 indexes) takes 1.2 ms.
How can we improve the insert row performance in Timesten ? Kindly assist.
Regards,
Karan
PS: During the test run, we monitored deadlocks and log buffer waits with the following query and both values never changed from zero
select PERM_ALLOCATED_SIZE,PERM_IN_USE_SIZE,TEMP_ALLOCATED_SIZE,TEMP_IN_USE_SIZE,DEADLOCKS,LOG_FS_READS,LOG_FS_WRITES,LOG_BUFFER_WAITS from sys.monitor;
Edited by: 853100 on Nov 2, 2012 4:19 AM
This is not very efficient as the statement will require likely need to be parsed for each INSERT. Even a soft parse is very expensive compared to the cost of the actual INSERT.
Can you try changing your code to something like the following just to evaluate the difference in performance. The object is to prepare the INSERT just once, outside of the INSERT loop and then execute the prepared INSERT many times passing the required input parameters. I'm not a Pro*C expert but an outline of the code looks something like this:
char * ins1 = " INSERT INTO ORDERS(
ORD_ORDER_NO ,
ORD_SERIAL_NO ,
ORD_SEM_SMST_SECURITY_ID,
ORD_BTM_EMM_MKT_TYPE ,
ORD_BTM_BOOK_TYPE ,
ORD_EXCH_ID ,
ORD_EPM_EM_ENTITY_ID ,
ORD_EXCH_ORDER_NO ,
ORD_CLIENT_ID ,
ORD_BUY_SELL_IND ,
ORD_TRANS_CODE ,
ORD_STATUS ,
ORD_ENTRY_DATE ,
ORD_ORDER_TIME ,
ORD_QTY_ORIGINAL ,
ORD_QTY_REMAINING ,
ORD_QTY_DISC ,
ORD_QTY_DISC_REMAINING ,
ORD_QTY_FILLED_TODAY ,
ORD_ORDER_PRICE ,
ORD_TRIGGER_PRICE ,
ORD_DISC_QTY_FLG ,
ORD_GTC_FLG ,
ORD_DAY_FLG ,
ORD_IOC_FLG ,
ORD_MIN_FILL_FLG ,
ORD_MKT_FLG ,
ORD_STOP_LOSS_FLG ,
ORD_AON_FLG ,
ORD_GOOD_TILL_DAYS ,
ORD_GOOD_TILL_DATE ,
ORD_AUCTION_NO ,
ORD_ACC_CODE ,
ORD_UM_USER_ID ,
ORD_MIN_FILL_QTY ,
ORD_SETTLEMENT_DAYS ,
ORD_COMPETITOR_PERIOD ,
ORD_SOLICITOR_PERIOD ,
ORD_PRO_CLIENT ,
ORD_PARTICIPANT_TYPE ,
ORD_PARTICIPANT_CODE ,
ORD_COUNTER_BROKER_CODE ,
ORD_CUSTODIAN_CODE ,
ORD_SETTLER ,
ORD_REMARKS ,
ORD_BSE_DELV_FLAG ,
ORD_BSE_NOTICE_NUM ,
ORD_ERROR_CODE ,
ORD_EXT_CLIENT_ID ,
ORD_SOURCE_FLG ,
ORD_BUY_BACK_FLG ,
ORD_RESERVE_FLG ,
ORD_BSE_REMARK ,
ORD_CARRY_FORWARD_FLAG ,
ORD_ORDER_OFFON ,
ORD_D2C1_FLAG ,
ORD_FI_RETAIL_FLG ,
ORD_OIB_INT_REF_ID ,
ORD_BOB_BASKET_ORD_NO ,
ORD_PRODUCT_ID ,
ORD_OIB_EXEC_REPORT_ID ,
ORD_BANK_DP_TXN_ID ,
ORD_USERINFO_PROG ,
ORD_BANK_CODE ,
ORD_BANK_ACC_NUM ,
ORD_DP_CODE ,
ORD_DP_ACC_NUM ,
ORD_SESSION_ORDER_TYPE ,
ORD_ORDER_CC_SEQ ,
ORD_RMS_DAEMON_STATUS ,
ORD_GROUP_ID ,
ORD_REASON_CODE ,
ORD_REASON_DESCRIPTION ,
ORD_SERIES_IND ,
ORD_BOB_BASKET_TYPE ,
ORD_ORIGINAL_TIME ,
ORD_TRD_EXCH_TRADE_NO,
ORD_MKT_PROT ,
ORD_SETTLEMENT_TYPE ,
ORD_SUB_CLIENT,
ORD_ALGO_OI_NUM,
ORD_FROM_ALGO_CLORDID,
ORD_FROM_ALGO_ORG_CLORDID
VALUES(
:lvar_ord_order_no ,
:lvar_ord_serial_no ,
ltrim(rtrim(:lvar_ord_sem_smst_security_id)),
ltrim(rtrim(:lvar_ord_btm_emm_mkt_type)),
ltrim(rtrim(:lvar_ord_btm_book_type)),
ltrim(rtrim(:lvar_ord_exch_id)) ,
decode(:lD2C1Flag,'N',ltrim(rtrim(:lvar_ord_epm_em_entity_id)),ltrim(rtrim(:sD2C1ControllerId))) ,
:insertExchOrderNo,
ltrim(rtrim(:lvar_ord_client_id)) ,
ltrim(rtrim(:lvar_ord_buy_sell_ind)),
:lvar_ord_trans_code,
:cTransitStatus ,
sysdate,
sysdate,
:lvar_ord_qty_original,
decode(:lvar_ord_qty_remaining ,-1,to_number(null),:lvar_ord_qty_remaining) ,
decode(:lvar_ord_qty_disc ,-1,to_number(null),:lvar_ord_qty_disc),
decode(:lvar_ord_qty_disc_remaining,-1,to_number(null),:lvar_ord_qty_disc_remaining),
:lvar_ord_qty_filled_today ,
:lvar_ord_order_price,
decode(:lvar_ord_trigger_price ,-1,to_number(null),:lvar_ord_trigger_price) ,
decode(:lvar_ord_disc_qty_flg ,-1,null,:lvar_ord_disc_qty_flg) ,
decode(:lvar_ord_gtc_flg ,-1,null,:lvar_ord_gtc_flg) ,
decode(:lvar_ord_day_flg ,-1,null,:lvar_ord_day_flg) ,
decode(:lvar_ord_ioc_flg ,-1,null,:lvar_ord_ioc_flg) ,
decode(:lvar_ord_min_fill_flg ,-1,null,:lvar_ord_min_fill_flg) ,
decode(:lvar_ord_mkt_flg ,-1,null,:lvar_ord_mkt_flg) ,
decode(:lvar_ord_stop_loss_flg ,-1,null,:lvar_ord_stop_loss_flg) ,
decode(:lvar_ord_aon_flg ,-1,null,:lvar_ord_aon_flg) ,
decode(:lvar_ord_good_till_days ,-1,to_number(null),:lvar_ord_good_till_days),
to_date(ltrim(rtrim(:lvar_ord_good_till_date)) ,'dd-mm-yyyy'),
:lvar_ord_auction_no,
ltrim(rtrim(:lvar_ord_acc_code)),
ltrim(rtrim(:lv_UserIdOrLogPktId)),
decode(:lvar_ord_min_fill_qty,-1,to_number(null),:lvar_ord_min_fill_qty),
:lvar_ord_settlement_days,
:lvar_ord_competitor_period,
:lvar_ord_solicitor_period,
:lvar_ord_pro_client ,
ltrim(rtrim(:lvar_ord_participant_type)),
ltrim(rtrim(:lvar_ord_participant_code)),
ltrim(rtrim(:lvar_ord_counter_broker_code)),
trim(:lvar_ord_custodian_code) ,
ltrim(rtrim(:lvar_ord_settler)),
ltrim(rtrim(:lvar_ord_remarks)),
ltrim(rtrim(:lvar_ord_bse_delv_flag)) ,
ltrim(rtrim(:lvar_ord_bse_notice_num)) ,
:lvar_ord_error_code ,
trim(:lvar_ord_ext_client_id) ,
ltrim(rtrim(:lvar_ord_source_flg)),
ltrim(rtrim(:lvar_ord_buyback_flg)),
:lvar_ord_reserve_flag ,
trim(:lvar_ord_bse_remark) ,
ltrim(rtrim(:lvar_ord_carryfwd_flg)),
:cOnStatus,
:lD2C1Flag,
:lSendToRemoteUser,
:lInternalRefId,
:lvar_bob_basket_ord_no,
ltrim(rtrim(:lvar_ord_product_id)),
trim(:lvar_ord_oib_exec_report_id) ,
:lvar_BankDpTxnId ,
ltrim(rtrim(:lEquBseUserCode )),
ltrim(rtrim(:lvar_BankCode)) ,
ltrim(rtrim(:lvar_BankAccNo)),
ltrim(rtrim(:lvar_DPCode)),
ltrim(rtrim(:lvar_DPAccNo)) ,
ltrim(rtrim(:lvar_OrderSessionType)) ,
:lvar_ord_order_cc_seq,
:lvar_ord_rms_daemon_status ,
:lvarGrpId,
:lvar_ord_reason_code ,
trim(:lvar_ord_reason_description) ,
:lSecSeriesInd,
ltrim(rtrim(:lBasketType)),
sysdate,
(-1 * :lvar_ord_serial_no),
:MktProt ,
:lvar_ord_sett_type,
ltrim(rtrim(:lvar_ca_cli_type)) ,
:ComplianceID,
ltrim(rtrim(:lvar_ClOrd)),
ltrim(rtrim(:lvar_OrgClOrd))
EXEC SQL AT :db_conn PREPARE i1 FROM :ins1;
logTimestamp("BEFORE inserting in orders table");
for (i=0; i<NUM_INSERTS; i++)
if ( strncmp(lvar_ord_exch_id.arr,"NSE",3) ==0 )
if(tmpExchOrderNo == -1)
insertExchOrderNo = NULL;
else
insertExchOrderNo = tmpExchOrderNo;
else if ( strncmp(lvar_ord_exch_id.arr,"BSE",3) ==0 )
if(tmpExchOrderNo == -1)
insertExchOrderNo = NULL;
else
insertExchOrderNo = tmpExchOrderNo;
lvar_ord_acc_code.len = strlen (lvar_ord_acc_code.arr);
sprintf (lv_UserIdOrLogPktId.arr,"%d",UserIdOrLogPktId );
lv_UserIdOrLogPktId.len = strlen (lv_UserIdOrLogPktId.arr) ;
lEquBseUserCode.len = fTrim(lEquBseUserCode.arr,16);
lvar_ord_buyback_flg.len = fTrim(lvar_ord_buyback_flg.arr,1);
lvar_ord_exch_id.len = fTrim(lvar_ord_exch_id.arr,3);
EXEC SQL AT :db_conn EXECUTE i1 USING
:lvar_ord_order_no ,
:lvar_ord_serial_no ,
:lvar_ord_sem_smst_security_id,
:lvar_ord_btm_emm_mkt_type,
etc. ;
logTimestamp("AFTER inserting in orders table");
/* Divide reported time by NUM_INSERTS to get average time for one insert */
Chris
Similar Messages
-
Delete DML statment takes more time than Update or Insert.
i want to know whether a delete statement takes more time than an update or insert DML command. Please help in solving the doubt.
Regards.i do not get good answers sometimes, so, i ask again.I think Alex answer to your post was quite complete. If you missed some information, continue the same post, instead of opening a new thread with the same subject and content.
You should be satistied with the answers you get, I also answered your question about global indexes, and I do think my answer was very complete. You may ask more if you want, but stop multiposting please. It is quite annoying.
Ok, have a nice day -
Query in timesten taking more time than query in oracle database
Hi,
Can anyone please explain me why query in timesten taking more time
than query in oracle database.
I am mentioning in detail what are my settings and what have I done
step by step.........
1.This is the table I created in Oracle datababase
(Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)...
CREATE TABLE student (
id NUMBER(9) primary keY ,
first_name VARCHAR2(10),
last_name VARCHAR2(10)
2.THIS IS THE ANONYMOUS BLOCK I USE TO
POPULATE THE STUDENT TABLE(TOTAL 2599999 ROWS)...
declare
firstname varchar2(12);
lastname varchar2(12);
catt number(9);
begin
for cntr in 1..2599999 loop
firstname:=(cntr+8)||'f';
lastname:=(cntr+2)||'l';
if cntr like '%9999' then
dbms_output.put_line(cntr);
end if;
insert into student values(cntr,firstname, lastname);
end loop;
end;
3. MY DSN IS SET THE FOLLWING WAY..
DATA STORE PATH- G:\dipesh3repo\db
LOG DIRECTORY- G:\dipesh3repo\log
PERM DATA SIZE-1000
TEMP DATA SIZE-1000
MY TIMESTEN VERSION-
C:\Documents and Settings\dipesh>ttversion
TimesTen Release 7.0.3.0.0 (32 bit NT) (tt70_32:17000) 2007-09-19T16:04:16Z
Instance admin: dipesh
Instance home directory: G:\TimestTen\TT70_32
Daemon home directory: G:\TimestTen\TT70_32\srv\info
THEN I CONNECT TO THE TIMESTEN DATABASE
C:\Documents and Settings\dipesh> ttisql
command>connect "dsn=dipesh3;oraclepwd=tiger";
4. THEN I START THE AGENT
call ttCacheUidPwdSet('SCOTT','TIGER');
Command> CALL ttCacheStart();
5.THEN I CREATE THE READ ONLY CACHE GROUP AND LOAD IT
create readonly cache group rc_student autorefresh
interval 5 seconds from student
(id int not null primary key, first_name varchar2(10), last_name varchar2(10));
load cache group rc_student commit every 100 rows;
6.NOW I CAN ACCESS THE TABLES FROM TIMESTEN AND PERFORM THE QUERY
I SET THE TIMING..
command>TIMING 1;
consider this query now..
Command> select * from student where first_name='2155666f';
< 2155658, 2155666f, 2155660l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.668822 seconds.
another query-
Command> SELECT * FROM STUDENTS WHERE FIRST_NAME='2340009f';
2206: Table SCOTT.STUDENTS not found
Execution time (SQLPrepare) = 0.074964 seconds.
The command failed.
Command> SELECT * FROM STUDENT where first_name='2093434f';
< 2093426, 2093434f, 2093428l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.585897 seconds.
Command>
7.NOW I PERFORM THE SIMILAR QUERIES FROM SQLPLUS...
SQL> SELECT * FROM STUDENT WHERE FIRST_NAME='1498671f';
ID FIRST_NAME LAST_NAME
1498663 1498671f 1498665l
Elapsed: 00:00:00.15
Can anyone please explain me why query in timesten taking more time
that query in oracle database.
Message was edited by: Dipesh Majumdar
user542575
Message was edited by:
user542575TimesTen
Hardware: Windows Server 2003 R2 Enterprise x64; 8 x Dual-core AMD 8216 2.41GHz processors; 32 GB RAM
Version: 7.0.4.0.0 64 bit
Schema:
create usermanaged cache group factCache from
MV_US_DATAMART
ORDER_DATE DATE,
IF_SYSTEM VARCHAR2(32) NOT NULL,
GROUPING_ID TT_BIGINT,
TIME_DIM_ID TT_INTEGER NOT NULL,
BUSINESS_DIM_ID TT_INTEGER NOT NULL,
ACCOUNT_DIM_ID TT_INTEGER NOT NULL,
ORDERTYPE_DIM_ID TT_INTEGER NOT NULL,
INSTR_DIM_ID TT_INTEGER NOT NULL,
EXECUTION_DIM_ID TT_INTEGER NOT NULL,
EXEC_EXCHANGE_DIM_ID TT_INTEGER NOT NULL,
NO_ORDERS TT_BIGINT,
FILLED_QUANTITY TT_BIGINT,
CNT_FILLED_QUANTITY TT_BIGINT,
QUANTITY TT_BIGINT,
CNT_QUANTITY TT_BIGINT,
COMMISSION BINARY_FLOAT,
CNT_COMMISSION TT_BIGINT,
FILLS_NUMBER TT_BIGINT,
CNT_FILLS_NUMBER TT_BIGINT,
AGGRESSIVE_FILLS TT_BIGINT,
CNT_AGGRESSIVE_FILLS TT_BIGINT,
NOTIONAL BINARY_FLOAT,
CNT_NOTIONAL TT_BIGINT,
TOTAL_PRICE BINARY_FLOAT,
CNT_TOTAL_PRICE TT_BIGINT,
CANCELLED_ORDERS_COUNT TT_BIGINT,
CNT_CANCELLED_ORDERS_COUNT TT_BIGINT,
ROUTED_ORDERS_NO TT_BIGINT,
CNT_ROUTED_ORDERS_NO TT_BIGINT,
ROUTED_LIQUIDITY_QTY TT_BIGINT,
CNT_ROUTED_LIQUIDITY_QTY TT_BIGINT,
REMOVED_LIQUIDITY_QTY TT_BIGINT,
CNT_REMOVED_LIQUIDITY_QTY TT_BIGINT,
ADDED_LIQUIDITY_QTY TT_BIGINT,
CNT_ADDED_LIQUIDITY_QTY TT_BIGINT,
AGENT_CHARGES BINARY_FLOAT,
CNT_AGENT_CHARGES TT_BIGINT,
CLEARING_CHARGES BINARY_FLOAT,
CNT_CLEARING_CHARGES TT_BIGINT,
EXECUTION_CHARGES BINARY_FLOAT,
CNT_EXECUTION_CHARGES TT_BIGINT,
TRANSACTION_CHARGES BINARY_FLOAT,
CNT_TRANSACTION_CHARGES TT_BIGINT,
ORDER_MANAGEMENT BINARY_FLOAT,
CNT_ORDER_MANAGEMENT TT_BIGINT,
SETTLEMENT_CHARGES BINARY_FLOAT,
CNT_SETTLEMENT_CHARGES TT_BIGINT,
RECOVERED_AGENT BINARY_FLOAT,
CNT_RECOVERED_AGENT TT_BIGINT,
RECOVERED_CLEARING BINARY_FLOAT,
CNT_RECOVERED_CLEARING TT_BIGINT,
RECOVERED_EXECUTION BINARY_FLOAT,
CNT_RECOVERED_EXECUTION TT_BIGINT,
RECOVERED_TRANSACTION BINARY_FLOAT,
CNT_RECOVERED_TRANSACTION TT_BIGINT,
RECOVERED_ORD_MGT BINARY_FLOAT,
CNT_RECOVERED_ORD_MGT TT_BIGINT,
RECOVERED_SETTLEMENT BINARY_FLOAT,
CNT_RECOVERED_SETTLEMENT TT_BIGINT,
CLIENT_AGENT BINARY_FLOAT,
CNT_CLIENT_AGENT TT_BIGINT,
CLIENT_ORDER_MGT BINARY_FLOAT,
CNT_CLIENT_ORDER_MGT TT_BIGINT,
CLIENT_EXEC BINARY_FLOAT,
CNT_CLIENT_EXEC TT_BIGINT,
CLIENT_TRANS BINARY_FLOAT,
CNT_CLIENT_TRANS TT_BIGINT,
CLIENT_CLEARING BINARY_FLOAT,
CNT_CLIENT_CLEARING TT_BIGINT,
CLIENT_SETTLE BINARY_FLOAT,
CNT_CLIENT_SETTLE TT_BIGINT,
CHARGEABLE_TAXES BINARY_FLOAT,
CNT_CHARGEABLE_TAXES TT_BIGINT,
VENDOR_CHARGE BINARY_FLOAT,
CNT_VENDOR_CHARGE TT_BIGINT,
ROUTING_CHARGES BINARY_FLOAT,
CNT_ROUTING_CHARGES TT_BIGINT,
RECOVERED_ROUTING BINARY_FLOAT,
CNT_RECOVERED_ROUTING TT_BIGINT,
CLIENT_ROUTING BINARY_FLOAT,
CNT_CLIENT_ROUTING TT_BIGINT,
TICKET_CHARGES BINARY_FLOAT,
CNT_TICKET_CHARGES TT_BIGINT,
RECOVERED_TICKET_CHARGES BINARY_FLOAT,
CNT_RECOVERED_TICKET_CHARGES TT_BIGINT,
PRIMARY KEY(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID, INSTR_DIM_ID, EXECUTION_DIM_ID,EXEC_EXCHANGE_DIM_ID),
READONLY);
No of rows: 2228558
Config:
< CkptFrequency, 600 >
< CkptLogVolume, 0 >
< CkptRate, 0 >
< ConnectionCharacterSet, US7ASCII >
< ConnectionName, tt_us_dma >
< Connections, 64 >
< DataBaseCharacterSet, AL32UTF8 >
< DataStore, e:\andrew\datacache\usDMA >
< DurableCommits, 0 >
< GroupRestrict, <NULL> >
< LockLevel, 0 >
< LockWait, 10 >
< LogBuffSize, 65536 >
< LogDir, e:\andrew\datacache\ >
< LogFileSize, 64 >
< LogFlushMethod, 1 >
< LogPurge, 0 >
< Logging, 1 >
< MemoryLock, 0 >
< NLS_LENGTH_SEMANTICS, BYTE >
< NLS_NCHAR_CONV_EXCP, 0 >
< NLS_SORT, BINARY >
< OracleID, NYCATP1 >
< PassThrough, 0 >
< PermSize, 4000 >
< PermWarnThreshold, 90 >
< PrivateCommands, 0 >
< Preallocate, 0 >
< QueryThreshold, 0 >
< RACCallback, 0 >
< SQLQueryTimeout, 0 >
< TempSize, 514 >
< TempWarnThreshold, 90 >
< Temporary, 1 >
< TransparentLoad, 0 >
< TypeMode, 0 >
< UID, OS_OWNER >
ORACLE:
Hardware: Sunos 5.10; 24x1.8Ghz (unsure of type); 82 GB RAM
Version 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
Schema:
CREATE MATERIALIZED VIEW OS_OWNER.MV_US_DATAMART
TABLESPACE TS_OS
PARTITION BY RANGE (ORDER_DATE)
PARTITION MV_US_DATAMART_MINVAL VALUES LESS THAN (TO_DATE(' 2007-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D1 VALUES LESS THAN (TO_DATE(' 2007-11-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D2 VALUES LESS THAN (TO_DATE(' 2007-11-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D3 VALUES LESS THAN (TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D1 VALUES LESS THAN (TO_DATE(' 2007-12-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D2 VALUES LESS THAN (TO_DATE(' 2007-12-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D3 VALUES LESS THAN (TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D1 VALUES LESS THAN (TO_DATE(' 2008-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D2 VALUES LESS THAN (TO_DATE(' 2008-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D3 VALUES LESS THAN (TO_DATE(' 2008-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_MAXVAL VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE TS_OS
NOCACHE
NOCOMPRESS
NOPARALLEL
BUILD DEFERRED
USING INDEX
TABLESPACE TS_OS_INDEX
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT order_date, if_system,
GROUPING_ID (order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id
) GROUPING_ID,
/* ============ DIMENSIONS ============ */
time_dim_id, business_dim_id, account_dim_id, ordertype_dim_id,
instr_dim_id, execution_dim_id, exec_exchange_dim_id,
/* ============ MEASURES ============ */
-- o.FX_RATE /* FX_RATE */,
COUNT (*) no_orders,
-- SUM(NO_ORDERS) NO_ORDERS,
-- COUNT(NO_ORDERS) CNT_NO_ORDERS,
SUM (filled_quantity) filled_quantity,
COUNT (filled_quantity) cnt_filled_quantity, SUM (quantity) quantity,
COUNT (quantity) cnt_quantity, SUM (commission) commission,
COUNT (commission) cnt_commission, SUM (fills_number) fills_number,
COUNT (fills_number) cnt_fills_number,
SUM (aggressive_fills) aggressive_fills,
COUNT (aggressive_fills) cnt_aggressive_fills,
SUM (fx_rate * filled_quantity * average_price) notional,
COUNT (fx_rate * filled_quantity * average_price) cnt_notional,
SUM (fx_rate * fills_number * average_price) total_price,
COUNT (fx_rate * fills_number * average_price) cnt_total_price,
SUM (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END) cancelled_orders_count,
COUNT (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END
) cnt_cancelled_orders_count,
-- SUM(t.FX_RATE*t.NO_FILLS*t.AVG_PRICE) AVERAGE_PRICE,
-- SUM(FILLS_NUMBER*AVERAGE_PRICE) STAGING_AVERAGE_PRICE,
-- COUNT(FILLS_NUMBER*AVERAGE_PRICE) CNT_STAGING_AVERAGE_PRICE,
SUM (routed_orders_no) routed_orders_no,
COUNT (routed_orders_no) cnt_routed_orders_no,
SUM (routed_liquidity_qty) routed_liquidity_qty,
COUNT (routed_liquidity_qty) cnt_routed_liquidity_qty,
SUM (removed_liquidity_qty) removed_liquidity_qty,
COUNT (removed_liquidity_qty) cnt_removed_liquidity_qty,
SUM (added_liquidity_qty) added_liquidity_qty,
COUNT (added_liquidity_qty) cnt_added_liquidity_qty,
SUM (agent_charges) agent_charges,
COUNT (agent_charges) cnt_agent_charges,
SUM (clearing_charges) clearing_charges,
COUNT (clearing_charges) cnt_clearing_charges,
SUM (execution_charges) execution_charges,
COUNT (execution_charges) cnt_execution_charges,
SUM (transaction_charges) transaction_charges,
COUNT (transaction_charges) cnt_transaction_charges,
SUM (order_management) order_management,
COUNT (order_management) cnt_order_management,
SUM (settlement_charges) settlement_charges,
COUNT (settlement_charges) cnt_settlement_charges,
SUM (recovered_agent) recovered_agent,
COUNT (recovered_agent) cnt_recovered_agent,
SUM (recovered_clearing) recovered_clearing,
COUNT (recovered_clearing) cnt_recovered_clearing,
SUM (recovered_execution) recovered_execution,
COUNT (recovered_execution) cnt_recovered_execution,
SUM (recovered_transaction) recovered_transaction,
COUNT (recovered_transaction) cnt_recovered_transaction,
SUM (recovered_ord_mgt) recovered_ord_mgt,
COUNT (recovered_ord_mgt) cnt_recovered_ord_mgt,
SUM (recovered_settlement) recovered_settlement,
COUNT (recovered_settlement) cnt_recovered_settlement,
SUM (client_agent) client_agent,
COUNT (client_agent) cnt_client_agent,
SUM (client_order_mgt) client_order_mgt,
COUNT (client_order_mgt) cnt_client_order_mgt,
SUM (client_exec) client_exec, COUNT (client_exec) cnt_client_exec,
SUM (client_trans) client_trans,
COUNT (client_trans) cnt_client_trans,
SUM (client_clearing) client_clearing,
COUNT (client_clearing) cnt_client_clearing,
SUM (client_settle) client_settle,
COUNT (client_settle) cnt_client_settle,
SUM (chargeable_taxes) chargeable_taxes,
COUNT (chargeable_taxes) cnt_chargeable_taxes,
SUM (vendor_charge) vendor_charge,
COUNT (vendor_charge) cnt_vendor_charge,
SUM (routing_charges) routing_charges,
COUNT (routing_charges) cnt_routing_charges,
SUM (recovered_routing) recovered_routing,
COUNT (recovered_routing) cnt_recovered_routing,
SUM (client_routing) client_routing,
COUNT (client_routing) cnt_client_routing,
SUM (ticket_charges) ticket_charges,
COUNT (ticket_charges) cnt_ticket_charges,
SUM (recovered_ticket_charges) recovered_ticket_charges,
COUNT (recovered_ticket_charges) cnt_recovered_ticket_charges
FROM us_datamart_raw
GROUP BY order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id;
-- Note: Index I_SNAP$_MV_US_DATAMART will be created automatically
-- by Oracle with the associated materialized view.
CREATE UNIQUE INDEX OS_OWNER.MV_US_DATAMART_UDX ON OS_OWNER.MV_US_DATAMART
(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID,
INSTR_DIM_ID, EXECUTION_DIM_ID, EXEC_EXCHANGE_DIM_ID)
NOLOGGING
NOPARALLEL
COMPRESS 7;
No of rows: 2228558
The query (taken Mondrian) I run against each of them is:
select sum("MV_US_DATAMART"."NOTIONAL") as "m0"
--, sum("MV_US_DATAMART"."FILLED_QUANTITY") as "m1"
--, sum("MV_US_DATAMART"."AGENT_CHARGES") as "m2"
--, sum("MV_US_DATAMART"."CLEARING_CHARGES") as "m3"
--, sum("MV_US_DATAMART"."EXECUTION_CHARGES") as "m4"
--, sum("MV_US_DATAMART"."TRANSACTION_CHARGES") as "m5"
--, sum("MV_US_DATAMART"."ROUTING_CHARGES") as "m6"
--, sum("MV_US_DATAMART"."ORDER_MANAGEMENT") as "m7"
--, sum("MV_US_DATAMART"."SETTLEMENT_CHARGES") as "m8"
--, sum("MV_US_DATAMART"."COMMISSION") as "m9"
--, sum("MV_US_DATAMART"."RECOVERED_AGENT") as "m10"
--, sum("MV_US_DATAMART"."RECOVERED_CLEARING") as "m11"
--,sum("MV_US_DATAMART"."RECOVERED_EXECUTION") as "m12"
--,sum("MV_US_DATAMART"."RECOVERED_TRANSACTION") as "m13"
--, sum("MV_US_DATAMART"."RECOVERED_ROUTING") as "m14"
--, sum("MV_US_DATAMART"."RECOVERED_ORD_MGT") as "m15"
--, sum("MV_US_DATAMART"."RECOVERED_SETTLEMENT") as "m16"
--, sum("MV_US_DATAMART"."RECOVERED_TICKET_CHARGES") as "m17"
--,sum("MV_US_DATAMART"."TICKET_CHARGES") as "m18"
--, sum("MV_US_DATAMART"."VENDOR_CHARGE") as "m19"
from "OS_OWNER"."MV_US_DATAMART" "MV_US_DATAMART"
where I uncomment a column at a time and rerun. I improved the TimesTen results since my first post, by retyping the NUMBER columns to BINARY_FLOAT. The results I got were:
No Columns ORACLE TimesTen
1 1.05 0.94
2 1.07 1.47
3 2.04 1.8
4 2.06 2.08
5 2.09 2.4
6 3.01 2.67
7 4.02 3.06
8 4.03 3.37
9 4.04 3.62
10 4.06 4.02
11 4.08 4.31
12 4.09 4.61
13 5.01 4.76
14 5.02 5.06
15 5.04 5.25
16 5.05 5.48
17 5.08 5.84
18 6 6.21
19 6.02 6.34
20 6.04 6.75 -
Count (*) for select stmt take more time than execute a that sql stmt
HI
count (*) for select stmt take more time than execute a that sql stmt
executing particular select stmt take 2.47 mins but select stmt is using the /*+parallel*/ (sql optimer) in that sql command for faster execute .
but if i tried to find out total number of rows in that query it takes more time ..
almost 2.30 hrs still running to find count(col)
please help me to get count of row faster.
thanks in advance...797525 wrote:
HI
count (*) for select stmt take more time than execute a that sql stmt
executing particular select stmt take 2.47 mins but select stmt is using the /*+parallel*/ (sql optimer) in that sql command for faster execute .
but if i tried to find out total number of rows in that query it takes more time ..
almost 2.30 hrs still running to find count(col)
please help me to get count of row faster.
thanks in advance...That may be because your client is displaying only the first few records when you are running the "SELECT *". But when you run "COUNT(*)", the whole records has to be counted.
As already mentined please read teh FAQ to post tuning questions. -
Why import of change request in production takes more time than quality?
Hello All,
why import of change request in production takes more time than import into quality?Hi jahangeer,
I believe it takes same time to import a request in both quality and production as they will be in sync.
Even then if it takes more time in production that may depend on the change request.
Thanks
Pavan -
When i put my Mac for sleep it takes more time than normal (>20 secs). Sometimes, coming back from sleep the system is not responding (freeze).
Perform SMC and NVRAM resets:
http://support.apple.com/en-us/HT201295
http://support.apple.com/en-us/HT204063
The try a safe boot:
http://support.apple.com/en-us/HT201262
Any change?
Ciao. -
Zfs destroy command takes more time than usual
Hi,
When I run the destroy command it takes more than usual.
I have exported the lun form this zfs volume ealier.
Later I have removed the lun view and deleted the lun.After that when I run the below command it takes more time (more than 5mins and still running)
#zfs destroy storage/luIs there a way to quickly destroy the filesystem.
It looks it removing the allocated files.
capacity operations bandwidth
pool alloc free read write read write
storage0 107G 116T 3.32K 2.52K 3.48M 37.7M
storage0 107G 116T 840 551 1.80M 6.01M
storage0 106G 116T 273 0 586K 0
storage0 106G 116T 1.19K 0 2.61M 0
storage0 106G 116T 1.47K 0 3.20M -
Calc takes more time than previous
Hi All,
I have a problem with the calc as this calc take more time to execute please help!!!
I have included calc cache high in the .cfg file.
FIX (&As, &Af, &C,&RM, @RELATIVE("Pr",0), @RELATIVE("MS",0), @RELATIVE("Pt",0), @RELATIVE("Rn",0),@RELATIVE("Ll",0))
CLEARDATA "RI";
/* 22 Comment */
FIX("100")
"RI" = @ROUND ((("RDL")/("SBE"->"RDL"->"TMS"->"TP"->"TR"->"AF"->"Boom")),8);
ENDFIX
FIX("200")
"RI" = @ROUND ((("RDL")/("ODE"->"RDL"->"TMS"->"T_P"->"TR"->"AF"->"Boom")),8);
ENDFIX
Appriciate your help.
Regards,
Mink.Mink,
If the calculation script ,which you are using is the same which performed better before and data being processes is same ( i mean data might not have exceptionally grown more).Then, there must be other reasons like server side OS , processor or memory issues.Consult sys admin .Atleast you ll be sure that there is nothing wrong with systems.
To fine tune the calc , i think , you can minimise fix statements . But,thats not the current issue though
Sandeep Reddy Enti
HCC
http://analytiks.blogspot.com -
Publishing EJBs takes more time in Oracle Weblogic 10.3 workshop
Hi,
We recently migrated from Weblogic 9.2 to Oracle Weblogic 10.3 workshop.
I have a ejb project which has more than 30 ejb's(both entity and session ejbs).
The problem is: whenever I modify the code inside a method and save, it builds the project automatically. After that when I try to publish the module, it takes around 5 - 10 minutes for publishing.
Points to note are : The ejb I am modifying has reference to other (10 - 20) ejbs. Hence it takes more time for even for single ejb change.
however, when i modify an ejb which has no reference to ejb, takes less time to publish.
My question is : is there a way to reduce the publishing time in this scenario.
Thanks in advance!There is a special forum for Workshop issues:
Workshop
Try there. -
SYS_REFCURSOR takes more time than direct query execution
I have a stored proc which has 4 inputs and 10 output and all outputs are sys_refcursor type.
Among 10 ouputs, 1 cursor returns 4k+ records and all other cursors has 3 or 4 records and average 5 columns in each cursors. For this, it takes 8 sec to complete the execution. If we directly query, it gives output in .025 sec.
I verified code located the issue with cursor which returns 4k+ only.
The cursor opening from a temporary table (which has 4k+ records ) without any filter. The query which inserted into temporary is direct inserts only and i found nothing to modify there.
Can anyone suggest, how we can bring the results in less than 3 sec? This is really a challenge since the code needs to go live next week.
Any help appreciated.
Thanks
RenjishI've just repeated the test in SQL*Plus on my test database.
Both the ref cursor and direct SQL took 4.75 seconds.
However, that time is not the time to execute the SQL statement, but the time it took SQL*Plus in my command window to print out the 3999 rows of results.
SQL> create or replace PROCEDURE TEST_PROC (O_OUTPUT OUT SYS_REFCURSOR) is
2 BEGIN
3 OPEN O_OUTPUT FOR
4 select 11 plan_num, 22 loc_num, 'aaa' loc_nm from dual connect by level < 4000;
5 end;
6 /
Procedure created.
SQL> set timing on
SQL> set linesize 1000
SQL> set serverout on
SQL> var o_output refcursor;
SQL> exec test_proc(:o_output);
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.04
SQL> print o_output;
PLAN_NUM LOC_NUM LOC
11 22 aaa
11 22 aaa
11 22 aaa
11 22 aaa
11 22 aaa
3999 rows selected.
Elapsed: 00:00:04.75
SQL> select 11 plan_num, 22 loc_num, 'aaa' loc_nm from dual connect by level < 4000;
PLAN_NUM LOC_NUM LOC
11 22 aaa
11 22 aaa
11 22 aaa
11 22 aaa
11 22 aaa
11 22 aaa
3999 rows selected.
Elapsed: 00:00:04.75
That's the result I expect to see, both taking the same amount of time to do the same thing.
Please demonstrate how you are running it and getting different results. -
Why HTML report takes more time than the PDF one?
Hi,
I have created report in Reports 6i. When I run the report on the web with FORMAT = PDF it runs very fast and shows all the pages in 2 minutes. But when I run with
FORMAT = HTML it shows the first page in 2 minutes, after that it takes lot of time to show the remaining pages. If the total pages are more than 40, the browser just freezes
Can somebody give me the reason?
Is there any way to rectify this?
Thanks alot.
Ram.Hi Senthil,
Iam running with the below parameters.
Format : HTML
Destination : Screen.
My default browser is IE. When I try to run using Netscape it showed only 1 page out of 34 pages.
When I run Format as PDF it is faster but font size is small when it opens up. Offcourse user can zoom it.
If I increase the report width from 11 to 14 the font size becomes very small when it open up in browser.
Is there any way that I can set up zoom when I run as PDF?
Thanks for your help.
Ram. -
11g takes more time than 9i to execute
Hi
We are trying to move 9.1.0.7 to 11.1.0.6 on Solaris 5.10. When we are trying to compare the performance on both database using the same SQL, it is noticed that 11g is taking about 10minutes more than 9i. The schema, objects, data, ... everything is similar. Can anyone please give an idea on why this difference?
SQL is:
--sql_id='bt04cp43n28m3'
--hash_value=2461919517
INSERT /*+APPEND */INTO act_com
(act_id, rep, ytd_fee, ytd_commission, mtd_fee, mtd_commission,
monthly_avg_fee, monthly_avg_comm, ttm_fee, ttm_commission,
curr_dec_fee, curr_dec_comm, curr_nov_fee, curr_nov_comm,
curr_oct_fee, curr_oct_comm, curr_sep_fee, curr_sep_comm,
curr_aug_fee, curr_aug_comm, curr_jul_fee, curr_jul_comm,
curr_jun_fee, curr_jun_comm, curr_may_fee, curr_may_comm,
curr_apr_fee, curr_apr_comm, curr_mar_fee, curr_mar_comm,
curr_feb_fee, curr_feb_comm, curr_jan_fee, curr_jan_comm,
yr1_dec_fee, yr1_dec_comm, yr1_nov_fee, yr1_nov_comm,
yr1_oct_fee, yr1_oct_comm, yr1_sep_fee, yr1_sep_comm,
yr1_aug_fee, yr1_aug_comm, yr1_jul_fee, yr1_jul_comm,
yr1_jun_fee, yr1_jun_comm, yr1_may_fee, yr1_may_comm,
yr1_apr_fee, yr1_apr_comm, yr1_mar_fee, yr1_mar_comm,
yr1_feb_fee, yr1_feb_comm, yr1_jan_fee, yr1_jan_comm,
yr2_dec_fee, yr2_dec_comm, yr2_nov_fee, yr2_nov_comm,
yr2_oct_fee, yr2_oct_comm, yr2_sep_fee, yr2_sep_comm,
yr2_aug_fee, yr2_aug_comm, yr2_jul_fee, yr2_jul_comm,
yr2_jun_fee, yr2_jun_comm, yr2_may_fee, yr2_may_comm,
yr2_apr_fee, yr2_apr_comm, yr2_mar_fee, yr2_mar_comm,
yr2_feb_fee, yr2_feb_comm, yr2_jan_fee, yr2_jan_comm,
tot_fee_prev_day, tot_comm_prev_day)
SELECT act.acct_no, x.rep,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr)
THEN x.dollar_amt
ELSE 0
END
) ytd_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr)
THEN x.dollar_amt
ELSE 0
END
) ytd_commission,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND curr_mm = mm)
THEN x.dollar_amt
ELSE 0
END
) mtd_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND curr_mm = mm)
THEN x.dollar_amt
ELSE 0
END
) mtd_comm,
SUM (CASE
WHEN ( x.cf_ind = 'F'
AND ( (yr = curr_yr - 1 AND mm >= curr_mm)
OR (yr = curr_yr AND mm < curr_mm)
THEN x.dollar_amt
ELSE 0
END
/ 12 monthly_avg_fee,
SUM (CASE
WHEN ( x.cf_ind = 'C'
AND ( (yr = curr_yr - 1 AND mm >= curr_mm)
OR (yr = curr_yr AND mm < curr_mm)
THEN x.dollar_amt
ELSE 0
END
/ 12 monthly_avg_comm,
SUM (CASE
WHEN ( x.cf_ind = 'F'
AND ( (yr = curr_yr - 1 AND mm > curr_mm)
OR (yr = curr_yr AND mm <= curr_mm)
THEN x.dollar_amt
ELSE 0
END
) ttm_fee,
SUM (CASE
WHEN ( x.cf_ind = 'C'
AND ( (yr = curr_yr - 1 AND mm > curr_mm)
OR (yr = curr_yr AND mm <= curr_mm)
THEN x.dollar_amt
ELSE 0
END
) ttm_commission,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 12)
THEN x.dollar_amt
ELSE 0
END
) curr_dec_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 12)
THEN x.dollar_amt
ELSE 0
END
) curr_dec_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 11)
THEN x.dollar_amt
ELSE 0
END
) curr_nov_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 11)
THEN x.dollar_amt
ELSE 0
END
) curr_nov_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 10)
THEN x.dollar_amt
ELSE 0
END
) curr_oct_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 10)
THEN x.dollar_amt
ELSE 0
END
) curr_oct_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 9)
THEN x.dollar_amt
ELSE 0
END
) curr_sep_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 9)
THEN x.dollar_amt
ELSE 0
END
) curr_sep_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 8)
THEN x.dollar_amt
ELSE 0
END
) curr_aug_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 8)
THEN x.dollar_amt
ELSE 0
END
) curr_aug_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 7)
THEN x.dollar_amt
ELSE 0
END
) curr_jul_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 7)
THEN x.dollar_amt
ELSE 0
END
) curr_jul_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 6)
THEN x.dollar_amt
ELSE 0
END
) curr_jun_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 6)
THEN x.dollar_amt
ELSE 0
END
) curr_jun_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 5)
THEN x.dollar_amt
ELSE 0
END
) curr_may_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 5)
THEN x.dollar_amt
ELSE 0
END
) curr_may_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 4)
THEN x.dollar_amt
ELSE 0
END
) curr_apr_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 4)
THEN x.dollar_amt
ELSE 0
END
) curr_apr_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 3)
THEN x.dollar_amt
ELSE 0
END
) curr_mar_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 3)
THEN x.dollar_amt
ELSE 0
END
) curr_mar_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 2)
THEN x.dollar_amt
ELSE 0
END
) curr_feb_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 2)
THEN x.dollar_amt
ELSE 0
END
) curr_feb_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr AND mm = 1)
THEN x.dollar_amt
ELSE 0
END
) curr_jan_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr AND mm = 1)
THEN x.dollar_amt
ELSE 0
END
) curr_jan_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 12)
THEN x.dollar_amt
ELSE 0
END
) yr1_dec_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 12)
THEN x.dollar_amt
ELSE 0
END
) yr1_dec_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 11)
THEN x.dollar_amt
ELSE 0
END
) yr1_nov_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 11)
THEN x.dollar_amt
ELSE 0
END
) yr1_nov_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 10)
THEN x.dollar_amt
ELSE 0
END
) yr1_oct_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 10)
THEN x.dollar_amt
ELSE 0
END
) yr1_oct_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 9)
THEN x.dollar_amt
ELSE 0
END
) yr1_sep_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 9)
THEN x.dollar_amt
ELSE 0
END
) yr1_sep_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 8)
THEN x.dollar_amt
ELSE 0
END
) yr1_aug_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 8)
THEN x.dollar_amt
ELSE 0
END
) yr1_aug_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 7)
THEN x.dollar_amt
ELSE 0
END
) yr1_jul_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 7)
THEN x.dollar_amt
ELSE 0
END
) yr1_jul_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 6)
THEN x.dollar_amt
ELSE 0
END
) yr1_jun_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 6)
THEN x.dollar_amt
ELSE 0
END
) yr1_jun_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 5)
THEN x.dollar_amt
ELSE 0
END
) yr1_may_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 5)
THEN x.dollar_amt
ELSE 0
END
) yr1_may_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 4)
THEN x.dollar_amt
ELSE 0
END
) yr1_apr_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 4)
THEN x.dollar_amt
ELSE 0
END
) yr1_apr_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 3)
THEN x.dollar_amt
ELSE 0
END
) yr1_mar_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 3)
THEN x.dollar_amt
ELSE 0
END
) yr1_mar_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 2)
THEN x.dollar_amt
ELSE 0
END
) yr1_feb_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 2)
THEN x.dollar_amt
ELSE 0
END
) yr1_feb_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 1 AND mm = 1)
THEN x.dollar_amt
ELSE 0
END
) yr1_jan_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 1 AND mm = 1)
THEN x.dollar_amt
ELSE 0
END
) yr1_jan_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 12)
THEN x.dollar_amt
ELSE 0
END
) yr2_dec_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 12)
THEN x.dollar_amt
ELSE 0
END
) yr2_dec_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 11)
THEN x.dollar_amt
ELSE 0
END
) yr2_nov_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 11)
THEN x.dollar_amt
ELSE 0
END
) yr2_nov_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 10)
THEN x.dollar_amt
ELSE 0
END
) yr2_oct_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 10)
THEN x.dollar_amt
ELSE 0
END
) yr2_oct_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 9)
THEN x.dollar_amt
ELSE 0
END
) yr2_sep_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 9)
THEN x.dollar_amt
ELSE 0
END
) yr2_sep_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 8)
THEN x.dollar_amt
ELSE 0
END
) yr2_aug_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 8)
THEN x.dollar_amt
ELSE 0
END
) yr2_aug_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 7)
THEN x.dollar_amt
ELSE 0
END
) yr2_jul_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 7)
THEN x.dollar_amt
ELSE 0
END
) yr2_jul_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 6)
THEN x.dollar_amt
ELSE 0
END
) yr2_jun_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 6)
THEN x.dollar_amt
ELSE 0
END
) yr2_jun_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 5)
THEN x.dollar_amt
ELSE 0
END
) yr2_may_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 5)
THEN x.dollar_amt
ELSE 0
END
) yr2_may_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 4)
THEN x.dollar_amt
ELSE 0
END
) yr2_apr_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 4)
THEN x.dollar_amt
ELSE 0
END
) yr2_apr_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 3)
THEN x.dollar_amt
ELSE 0
END
) yr2_mar_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 3)
THEN x.dollar_amt
ELSE 0
END
) yr2_mar_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 2)
THEN x.dollar_amt
ELSE 0
END
) yr2_feb_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 2)
THEN x.dollar_amt
ELSE 0
END
) yr2_feb_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND yr = curr_yr - 2 AND mm = 1)
THEN x.dollar_amt
ELSE 0
END
) yr2_jan_fee,
SUM (CASE
WHEN (x.cf_ind = 'C' AND yr = curr_yr - 2 AND mm = 1)
THEN x.dollar_amt
ELSE 0
END
) yr2_jan_comm,
SUM (CASE
WHEN (x.cf_ind = 'F' AND asof_cymd = bus_day)
THEN x.dollar_amt
ELSE 0
END
) tot_fee_prev_day,
SUM (CASE
WHEN (x.cf_ind = 'C' AND asof_cymd = bus_day)
THEN x.dollar_amt
ELSE 0
END
) tot_comm_prev_day
FROM (SELECT acct_no, status
FROM action_tab
UNION
SELECT '0' acct_no, 'AC' status
FROM DUAL) act,
(SELECT TO_NUMBER (TO_CHAR (TO_DATE (NVL (asof_cymd, trade_cymd),
'YYYY-MM-DD'
'YYYY'
) yr,
TO_NUMBER (TO_CHAR (TO_DATE (NVL (asof_cymd, trade_cymd),
'YYYY-MM-DD'
'MM'
) mm,
TO_NUMBER (TO_CHAR (h_inner.bus_day, 'yyyy')) curr_yr,
TO_NUMBER (TO_CHAR (h_inner.bus_day, 'mm')) curr_mm,
rep_commission,
TO_DATE (NVL (asof_cymd, trade_cymd),
'YYYY-MM-DD'
) asof_cymd,
c.acct_no, rep_full rep, f.acct_no fba_acct,
CASE
WHEN ( TO_DATE (f.close_cymd, 'YYYY-MM-DD') <=
SYSDATE
OR f.acct_no IS NULL
THEN 'C'
ELSE 'F'
END cf_ind,
CASE
WHEN (adj_commission != 0
AND adj_commission IS NOT NULL
THEN adj_commission
ELSE NVL (commission, 0) + NVL (mark_up_down, 0)
END dollar_amt
FROM coding_tab c, fbaact_tab f, hist_dt_ctrl_tab h_inner
WHERE c.acct_no = f.acct_no(+)) x,
hist_dt_ctrl_tab
WHERE act.acct_no = x.acct_no
AND x.rep IS NOT NULL
--AND act.rep = x.rep
AND act.status IN ('AC', 'IN')
GROUP BY act.acct_no, x.rep
Thanks in advance.Hi
The details given below.
Execution Plan on 9i
1.00 2,412.00 SELECT STATEMENT 93,164.00 260,496.00 93,164.00 CHOOSE
2.00 2,412.00 -SORT GROUP BY 93,164.00 260,496.00 93,164.00
3.00 8,684,104.00 --NESTED LOOPS OUTER 17,410.00 937,883,232.00 17,410.00
4.00 8,684,104.00 ---HASH JOIN 17,410.00 772,885,256.00 17,410.00
5.00 538,055.00 ----MERGE JOIN CARTESIAN 5,632.00 28,516,915.00 5,632.00
6.00 1.00 -----MERGE JOIN CARTESIAN 6.00 14.00 6.00
7.00 1.00 ------TABLE ACCESS FULL HIST_DT_CTRL 3.00 7.00 3.00 ANALYZED
7.00 1.00 ------BUFFER SORT 3.00 7.00 3.00
8.00 1.00 -------TABLE ACCESS FULL HIST_DT_CTRL 3.00 7.00 3.00 ANALYZED
6.00 538,055.00 -----BUFFER SORT 5,629.00 20,984,145.00 5,629.00
7.00 538,055.00 ------VIEW 5,626.00 20,984,145.00
8.00 538,055.00 -------SORT UNIQUE 5,626.00 5,298,870.00 5,599.00
9.00 --------UNION-ALL
10.00 529,887.00 ---------TABLE ACCESS FULL ACTION_TAB 4,164.00 5,298,870.00 4,164.00 ANALYZED
10.00 8,168.00 ---------TABLE ACCESS FULL DUAL 11.00 11.00
5.00 3,518,688.00 ----TABLE ACCESS FULL CODING_TAB 3,978.00 126,672,768.00 3,978.00 ANALYZED
4.00 1.00 ---TABLE ACCESS BY INDEX ROWID FBAACT_TAB 19.00 ANALYZED
5.00 1.00 ----INDEX UNIQUE SCAN FBA_ACT_PK_ACCT_NO ANALYZED
Execution Plan on 11g
1.00 2,399.00 SELECT STATEMENT 37,681.00 271,087.00 17,370,453,529.00 35,293.00 ALL_ROWS
2.00 2,399.00 -HASH GROUP BY 37,681.00 271,087.00 17,370,453,529.00 35,293.00
3.00 10,291,120.00 --HASH JOIN RIGHT OUTER 36,195.00 1,162,896,560.00 6,562,221,120.00 35,293.00
4.00 1.00 ---TABLE ACCESS FULL FBAACT_TAB 2.00 19.00 7,121.00 2.00 ANALYZED
4.00 10,291,120.00 ---HASH JOIN 36,051.00 967,365,280.00 5,529,464,283.00 35,291.00
5.00 660,746.00 ----MERGE JOIN CARTESIAN 14,778.00 38,323,268.00 2,126,486,738.00 14,486.00
6.00 1.00 -----MERGE JOIN CARTESIAN 10.00 16.00 185,497.00 10.00
7.00 1.00 ------TABLE ACCESS FULL HISTDT_CTRL 5.00 8.00 92,749.00 5.00 ANALYZED
7.00 1.00 ------BUFFER SORT 5.00 8.00 92,749.00 5.00
8.00 1.00 -------TABLE ACCESS FULL HISTDT_CTRL 5.00 8.00 92,749.00 5.00 ANALYZED
6.00 660,746.00 -----BUFFER SORT 14,773.00 27,751,332.00 2,126,393,989.00 14,481.00
7.00 660,746.00 ------VIEW 14,768.00 27,751,332.00 2,126,301,241.00 14,476.00
8.00 660,746.00 -------SORT UNIQUE 14,768.00 6,607,450.00 2,119,018,839.00 14,474.00
9.00 --------UNION-ALL
10.00 660,745.00 ---------TABLE ACCESS FULL ACTION_TAB 12,058.00 6,607,450.00 1,494,346,997.00 11,853.00 ANALYZED
10.00 1.00 ---------FAST DUAL 2.00 7,271.00 2.00
5.00 3,418,417.00 ----TABLE ACCESS FULL CODING_TAB 11,116.00 123,063,012.00 1,823,935,730.00 10,865.00 ANALYZED
The differences in INIT Parameters
9i 11g
multi_block_read_count 16 128
optimizer_mode choose all_rows
other h/w and load related
CPUs 8@900MHZ 8@1200MHZ
load used by many QA users just testing to make sure
all our cronjobs are running
fine or not
the above mentioned SQL is part of one of the processes, takes about 41 min on 9i and the same taking about 52-56 minutes on 11g.
Also, I took out every in-line SELECT statement and ran in both envs. looks 11g is executing them fast. But as a whole it takes about 10-12 mins more on 11g. So
I suspect that its problem with INSERT statement. So I just wrote a simple PL/SQL block to insert 1m records and tested on both.
INSERTION OF 1M records 1:46 min 2:06 min
count(*) 0:0.35 sec 0:0.17 sec
delete 0:28.9 sec 0:36.72 sec
rollback 0:32.19 sec 0:41.36 sec -
Threaded program takes more time than running serially!
Hello All
Ive converted my program into a threaded application so as to improve speed. However i found that after converting the execution time is more than it was when the program was non threaded. Im not having any synchronised methods. Any idea what could be the reason ?
Thanx in advance.First, if you are doing I/O, then maybe that's what's taking the time and not the threads. One question that hasn't been asked about your problem:
How much is the time difference? If it takes like 10 seconds to run the one and 10 minutes to run the threaded version, then that's a big difference. But if it is like 10 seconds vs 11 seconds, I think you should reconsider if it matters so much.
One analogy that comes to mind about multiple threads vs. sequential code is this:
With sequentially run code, all the code segments are lined up in order and they all go thru the door one after the other. As one goes thru they all move up closer, thus they know who's going first.
With multi-threaded code, all the code segments sorta pile up around the door in a big crowd. Some push go thru one at a time while others let them (priority), while other times 2 go for the door at the same time and there might be a few moments of "oh, after you", "no, after you", "oh no, I insist, after you" before one goes thru. So that could introduce some delay. -
Threaded program takes more time than executing serially!
Hello All
Ive converted my program into a threaded application so as to improve speed. However i found that after converting the execution time is more than it was when the program was non threaded. Im not having any synchronised methods. Any idea what could be the reason ?
Thanx in advance.Putting aside fstreams amusing comment, I suspect your
theads are never yielding (they are sitting in a tight
loop, thus taking all available procesor power). Try
adding Thread.sleep(0) at som point in the loop.No. If you just want to encourage one thread to give another thread a turn, use yield, not sleep.
Note, though, that this may not help your situation. As was pointed out, on a single CPU machine, the only way a multithreaded program will run faster (by which I mean total wall-clock time start to finish) than its single-threaded equivalent is if the 1-thread version spends a lot of time waiting for IO when it could be doing something else. (If it's waiting for IO, but that IO is needed for the big number crunching, then putting the crunching in another thread won't make things any faster.)
On the other hand, if by "faster" you're referring to a more responsive GUI, then, yes, in general you might expect better GUI response be putting non-GUI stuff in a different thread, but there's no guarantee. Depending on what the other thread does, how much work your GUI has to do, how your VM's scheduler works, how you've split up the work, etc., it may not be any better.
I know that's not very specific, but neither was your question. -
Delete DML statment tales more time than Update or Insert.
i want to know whether a delete statement takes more time than an update or insert DML command. Please help in solving the doubt.
Regards.I agree: the amount of ROLLBACK (called UNDO) and ROLLFORWARD (called REDO) information written by the various statement has a crucial impact on the speed.
I did some simple benchmarks for INSERT, UPDATE and DELETE using a 1 million row simple table. As an alternative to the long UPDATEs and DELETEs, I tested also the usual workarounds (which have only partial applicability).
Here are the conclusions (quite important in my opinion, but not to be taken as universal truth):
1. Duration of DML statements for 1 million rows operations (with the size of redo generated):
--- INSERT: 3.5 sec (redo: 3.8 MB)
--- UPDATE: 24.8 sec (redo: 240 MB)
--- DELETE: 26.1 sec (redo: 228 MB)
2. Replacement of DELETE with TRUNCATE
--- DELETE: 26.1 sec (rollback: 228 MB)
--- TRUNCATE: 0.1 sec (rollback: 0.1 MB)
3. Replacement of UPDATE with CREATE new TABLE AS SELECT (followed by DROP ols and RENAME new AS old)
--- UPDATE: 24.8 sec (redo_size: 240 MB)
--- replacement: 3.5 sec (rollback: 0.3 MB)
-- * Preparation *
CREATE TABLE ao AS
SELECT rownum AS id,
'N' || rownum AS name
FROM all_objects, all_objects
WHERE rownum <= 1000000;
CREATE OR REPLACE PROCEDURE print_my_stat(p_name IN v$statname.NAME%TYPE) IS
v_value v$mystat.VALUE%TYPE;
BEGIN
SELECT b.VALUE
INTO v_value
FROM v$statname a,
v$mystat b
WHERE a.statistic# = b.statistic# AND lower(a.NAME) LIKE lower(p_name);
dbms_output.put_line('*' || p_name || ': ' || v_value);
END print_my_stat;
-- * Test 1: Comparison of INSERT, UPDATE and DELETE *
CREATE TABLE ao1 AS
SELECT * FROM ao WHERE 1 = 2;
exec print_my_stat('redo_size')
*redo_size= 277,220,544
INSERT INTO ao1 SELECT * FROM ao;
1000000 rows inserted
executed in 3.465 seconds
exec print_my_stat('redo_size')
*redo_size= 301,058,852
commit;
UPDATE ao1 SET name = 'M' || SUBSTR(name, 2);
1000000 rows updated
executed in 24.786 seconds
exec print_my_stat('redo_size')
*redo_size= 545,996,280
commit;
DELETE FROM ao1;
1000000 rows deleted
executed in 26.128 seconds
exec print_my_stat('redo_size')
*redo_size= 783,655,196
commit;
-- * Test 2: Replace DELETE with TRUNCATE *
DROP TABLE ao1;
CREATE TABLE ao1 AS
SELECT * FROM ao;
exec print_my_stat('redo_size')
*redo_size= 807,554,512
TRUNCATE TABLE ao1;
executed in 0.08 seconds
exec print_my_stat('redo_size')
*redo_size= 807,616,528
-- * Test 3: Replace UPDATE with CREATE TABLE AS SELECT *
INSERT INTO ao1 SELECT * FROM ao;
commit;
exec print_my_stat('redo_size')
*redo_size= 831,525,556
CREATE TABLE ao2 AS
SELECT id, 'M' || SUBSTR(name, 2) name FROM ao1;
executed in 3.125 seconds
DROP TABLE ao1;
executed in 0.32 seconds
RENAME ao2 TO ao1;
executed in 0.01 seconds
exec print_my_stat('redo_size')
*redo_size= 831,797,608
Maybe you are looking for
-
How to insert and view data in a structure???
Hi to everyone! I'm trying to append my user define table to a standard table. First i tried like this. 1. I went to the append structure in a transparent table, created one and then included my table in it. It says table cannot be appended in the da
-
I have problem with login in sql Server give me support .pre login handshake
I have problem with login in sql Server give me support .pre login handshake
-
Has anyone tried using "ffmpegx" to compress video files to Xvid files?
Has anyone tried using the program ffmpegx to compress your video files into Xvid files? Still trying to find a magic solution to save some space on my hard drive
-
Hi Experts, I am using BI 7 and my reports are showing Currency Unit for key figures at the top (in row header only) Whereas I want them to be shown with the Key figure Values. Current View Desired plant Sales
-
No instance of object type PurchaseRequisition has been created.
Hi, We are facing a problem while creating purchase requisition documents with the help of IDocs. We are using the SAP standard function module to create purchase requisition. But IDocs are failing in the above mentioned error. This is the function m