Order By Query runing very slow
I am facing a problem when doing order by on a table.
My select query is working fine, but when i do order by (even on the primary key) it just goes on and on with no results. Finally i need to kill the session. The table has20K records. Any suggestion for the this? Query is as:
SELECT * FROM Users ORDER BY ID;
I do not about know about the query plan as i am new to oracle.
Please refer to SQL and PL/SQL FAQ
Right now there is too little information to post anything sensible as an answer.
Sybrand Bakker
Senior Oracle DBA
Similar Messages
-
Order Import program run very slow
Hi
I use Order Import program to create sale order from tables interface.But it run very slow,about two hours for one record.
How can i do it run fast?
ThanksHi,
before checking metalink for patches (there are some performance related patches for order entry)
you should check if statistics OE related tables
- OE_HEADERS_IFACE_ALL,
- OE_ORDER_HEADERS_ALL
- OE_LINES_IFACE_ALL
- OE_ORDER_LINES_ALL
are up to date (check column last_analyzed in dba_tables). If not, run gather schema statistics
program to collect current table statistics for OE schema.
If this does not help, have a look at metalink and query for "order import" "performance"...
Regards -
Challenging Query working very slow
Hi Guys
my query is working very slow .. i think i am using old functions to fetch data .. is anybody can recommand changes into it to make it faster
SELECT a.Student_Updated,
a.Course_Updated,
b.Notes_Updated,
a.School_ID,
a.School_Code,
a.School_Name,
a.Course_Code,
a.Course_Name,
ass.ass_type Assessment_Type,
ass.ass_status Assessment_Status,
ass.ass_work_due_date Assessment_Date,
ass.ass_result_achieved Assessment_result,
a.Last_Name,
a.First_Name,
a.Initials,
a.Stud_ID,
a.User_ID,
a.Email,
b.Code1,
b.Code2,
b.Code3,
b.Code4,
b.Code5,
b.Code6,
b.Code7,
b.Code8,
b.Code9,
b.Code10,
b.Code11,
b.Code12,
b.Code13,
b.Code14,
b.Code15,
b.Code16,
b.Code17,
b.Code18,
b.Code19,
b.Code20,
b.Code21,
b.Code22,
b.Code23,
b.Code24,
a.Cert_Status,
a.Class_Status,
b.Notes1,
b.Notes2,
b.Notes3,
b.Notes4
FROM
(SELECT s.s_ref Stud_ID,
s.s_date_changed Student_Updated,
max(sba.sba_date_changed) Course_Updated,
cc.cc_user_value_1 School_ID,
lv.lv_high_value School_Code,
lv.lv_meaning School_Name,
sba.sba_sb_ref Course_Code,
sb.sb_name Course_Name,
s.s_surname Last_Name,
s.s_forename_1 First_Name,
substr(s.s_forename_2, 1, 1) Initials,
s.s_vehicle_reg_no User_ID,
decode(s.s_e_mail_address,
null, decode(s.s_vehicle_reg_no,
null, null, s.s_vehicle_reg_no||'@abdn.ac.uk'),
s.s_e_mail_address||'@aberdeen.ac.uk') Email,
sba.sba_significance Cert_Status,
sba.sba_status Class_Status
FROM students s,
study_block_associations sba,
study_blocks sb,
cost_centres cc,
calendar_periods cp,
local_values lv
WHERE s.s_ref = sba.sba_s_ref
AND sba.sba_sb_ref = sb.sb_ref
AND sb.sb_cc_ref = cc.cc_ref
AND cc.cc_user_value_1 = lv.lv_value(+)
AND lv.lv_domain = 'CC USER VALUE 1'
-- AND nvl(s.s_disabilities, '99') not in ('0', '0T', '00', '97', '98', '99')
AND length(sba.sba_sb_ref) = '6'
AND instr('L|W', sba.sba_status) > 0
AND sba.sba_type = 'E'
AND sba.sba_calp_period_code = cp.calp_period_code
AND calp_cal_ref = 'RYEAR'
AND trunc(sysdate) BETWEEN calp_start_date AND calp_end_date
GROUP BY
s.s_ref,
s.s_date_changed,
sba.sba_sb_ref,
sb.sb_name,
cc.cc_user_value_1,
lv.lv_high_value,
lv.lv_meaning,
s.s_surname,
s.s_forename_1,
substr(s.s_forename_2, 1, 1),
s.s_disabilities,
s.s_vehicle_reg_no,
decode( s.s_e_mail_address,
null, decode( s.s_vehicle_reg_no,
null, null,
s.s_vehicle_reg_no||'@abdn.ac.uk'),
s.s_e_mail_address||'@aberdeen.ac.uk'),
sba.sba_significance,
sba.sba_status
) a,
(SELECT sle.sle_s_ref Stud_ID,
max(sle.sle_date_created) Notes_Updated,
sum(case when sle.sle_le_ref = '01' then 1 else 0 end) Code1,
sum(case when sle.sle_le_ref = '02' then 1 else 0 end) Code2,
sum(case when sle.sle_le_ref = '03' then 1 else 0 end) Code3,
sum(case when sle.sle_le_ref = '04' then 1 else 0 end) Code4,
sum(case when sle.sle_le_ref = '05' then 1 else 0 end) Code5,
sum(case when sle.sle_le_ref = '06' then 1 else 0 end) Code6,
sum(case when sle.sle_le_ref = '07' then 1 else 0 end) Code7,
sum(case when sle.sle_le_ref = '08' then 1 else 0 end) Code8,
sum(case when sle.sle_le_ref = '09' then 1 else 0 end) Code9,
sum(case when sle.sle_le_ref = '10' then 1 else 0 end) Code10,
sum(case when sle.sle_le_ref = '11' then 1 else 0 end) Code11,
sum(case when sle.sle_le_ref = '12' then 1 else 0 end) Code12,
sum(case when sle.sle_le_ref = '13' then 1 else 0 end) Code13,
sum(case when sle.sle_le_ref = '14' then 1 else 0 end) Code14,
sum(case when sle.sle_le_ref = '15' then 1 else 0 end) Code15,
sum(case when sle.sle_le_ref = '16' then 1 else 0 end) Code16,
sum(case when sle.sle_le_ref = '17' then 1 else 0 end) Code17,
sum(case when sle.sle_le_ref = '18' then 1 else 0 end) Code18,
sum(case when sle.sle_le_ref = '19' then 1 else 0 end) Code19,
sum(case when sle.sle_le_ref = '20' then 1 else 0 end) Code20,
sum(case when sle.sle_le_ref = '21' then 1 else 0 end) Code21,
sum(case when sle.sle_le_ref = '22' then 1 else 0 end) Code22,
sum(case when sle.sle_le_ref = '23' then 1 else 0 end) Code23,
sum(case when sle.sle_le_ref = '24' then 1 else 0 end) Code24,
sle4.Notes1,
sle4.Notes2,
sle4.Notes3,
sle4.Notes4
FROM abdn_student_le_provisions sle,
(SELECT sle3.sle_s_ref,
max(case when sle3.ord = 1 then sle3.sle_description end) Notes1,
max(case when sle3.ord = 2 then sle3.sle_description end) Notes2,
max(case when sle3.ord = 3 then sle3.sle_description end) Notes3,
max(case when sle3.ord = 4 then sle3.sle_description end) Notes4
FROM (SELECT row_number() over (partition by sle2.sle_s_ref order by sle2.sle_s_ref) as ord,
sle2.sle_s_ref,
sle2.sle_description
FROM abdn_student_le_provisions sle2
WHERE sle2.sle_description is not null
) sle3
GROUP BY
sle3.sle_s_ref
) sle4
WHERE sle.sle_s_ref = sle4.sle_s_ref(+)
GROUP BY
sle.sle_s_ref,
sle4.Notes1,
sle4.Notes2,
sle4.Notes3,
sle4.Notes4
) b,
assessments ass
WHERE a.Stud_ID = b.Stud_ID
AND a.Stud_ID = ass.ass_s_ref(+)
AND a.Course_Code = ass.ass_sb_ref(+);Thread: HOW TO: Post a SQL statement tuning request - template posting
HOW TO: Post a SQL statement tuning request - template posting -
Some body please help about the Inventory FIFO (FIRST IN FISRT OUT ) query is very slow
I have table ''tran_stock'' to store a transaction (IN-OUT) of the stock.
The problem is when the transaction rows are more than 50000 the query to get the balance
stock (Total 'IN' - Total'Out' by FIFO) is very slow . Somebody please suggest me to do this.
This is my query
;WITH OrderedIn as (
select *,ROW_NUMBER() OVER (PARTITION BY Stock_ID ORDER BY TranDate) as rn
from Tran_Stock
where TxnType = 'IN'
), RunningTotals as (
select Stock_ID ,Qty,Price,Qty as Total,Cast(0 as decimal(10,2)) as PrevTotal , trandate , rn from OrderedIn where rn = 1
union all
select rt.Stock_ID,oi.Qty,oi.Price,Cast(rt.Total + oi.Qty as decimal(10,2)),Cast(rt.Total as decimal(10,2)) , oi.TranDate ,oi.rn
from
RunningTotals rt
inner join
OrderedIn oi
on
rt.Stock_ID = oi.Stock_ID and
rt.rn = oi.rn - 1
, TotalOut as (
select Stock_ID ,SUM(Qty) as Qty from Tran_Stock where TxnType='OUT' group by Stock_ID
) , GrandTotal as
select
rt.Stock_ID , rt.QTY AS original ,SUM(CASE WHEN PrevTotal > isNULL(out.Qty, 0) THEN rt.Qty ELSE rt.Total - isNULL(out.Qty, 0) END) AS QTY , Price , SUM(CASE WHEN PrevTotal > isNULL(out.Qty, 0) THEN rt.Qty ELSE rt.Total - isNULL(out.Qty,
0) END * Price) AS Ending , rt.TranDate
from
RunningTotals rt
LEFT join
TotalOut out
on
rt.Stock_ID = out.Stock_ID
where rt.Total > isNull(out.Qty , 0)
group by rt.Stock_ID , Price , rt.TranDate , rt.QTY
) SELECT * FROM GrandTotal order by TranDate option (maxrecursion 0)
AND this is my Table with some example data
USE [TestInventory]
GO
/****** Object: Table [dbo].[Tran_Stock] Script Date: 12/15/2014 3:55:56 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tran_Stock](
[TranID] [int] IDENTITY(1,1) NOT NULL,
[Stock_ID] [int] NULL,
[TranDate] [date] NULL,
[TxnType] [nvarchar](3) NULL,
[Qty] [decimal](10, 2) NULL,
[Price] [decimal](10, 2) NULL
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Tran_Stock] ON
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (1, 1, CAST(0x81350B00 AS Date), N'IN', CAST(200.00 AS Decimal(10, 2)), CAST(750.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (2, 1, CAST(0x85350B00 AS Date), N'OUT', CAST(100.00 AS Decimal(10, 2)), NULL)
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (3, 1, CAST(0x8A350B00 AS Date), N'IN', CAST(50.00 AS Decimal(10, 2)), CAST(700.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (4, 1, CAST(0x90350B00 AS Date), N'IN', CAST(75.00 AS Decimal(10, 2)), CAST(800.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (5, 1, CAST(0x99350B00 AS Date), N'OUT', CAST(175.00 AS Decimal(10, 2)), NULL)
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (6, 2, CAST(0x82350B00 AS Date), N'IN', CAST(150.00 AS Decimal(10, 2)), CAST(350.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (7, 2, CAST(0x88350B00 AS Date), N'OUT', CAST(40.00 AS Decimal(10, 2)), NULL)
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (8, 2, CAST(0x8C350B00 AS Date), N'OUT', CAST(10.00 AS Decimal(10, 2)), NULL)
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (9, 2, CAST(0x98350B00 AS Date), N'IN', CAST(90.00 AS Decimal(10, 2)), CAST(340.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (12, 2, CAST(0x98350B00 AS Date), N'IN', CAST(10.00 AS Decimal(10, 2)), CAST(341.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (13, 2, CAST(0x99350B00 AS Date), N'OUT', CAST(30.00 AS Decimal(10, 2)), NULL)
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (14, 2, CAST(0x81350B00 AS Date), N'IN', CAST(120.00 AS Decimal(10, 2)), CAST(350.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (15, 2, CAST(0x89350B00 AS Date), N'OUT', CAST(90.00 AS Decimal(10, 2)), NULL)
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (17, 3, CAST(0x89350B00 AS Date), N'IN', CAST(90.00 AS Decimal(10, 2)), CAST(350.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (18, 3, CAST(0x8A350B00 AS Date), N'OUT', CAST(60.00 AS Decimal(10, 2)), NULL)
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (19, 3, CAST(0x5D390B00 AS Date), N'OUT', CAST(20.00 AS Decimal(10, 2)), NULL)
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (20, 1, CAST(0x81350B00 AS Date), N'IN', CAST(200.00 AS Decimal(10, 2)), CAST(750.00 AS Decimal(10, 2)))
INSERT [dbo].[Tran_Stock] ([TranID], [Stock_ID], [TranDate], [TxnType], [Qty], [Price]) VALUES (21, 1, CAST(0x85350B00 AS Date), N'OUT', CAST(100.00 AS Decimal(10, 2)), NULL)Hi,
You dont have any Index on the table, so the filters (where part in the queries) and the sorting (order by, group by) make your query slow. it take time to sort or filter data without Index. It is like reading a book with 3k pages and trying to find a specific
subject. You have to read the all books, but if you have "table of contents" which is the book index, then this can be done fast.
* check the Execution plan (the image here show part of your query's execution plan). the query scan the all table 3 times...
there is one sort that use 81% of the query resources... I will go sleep soon (it is
23:58 In Israel now), and I don't know if I will have time to read the query itself and improved it, so lets start with indexes :-)
** as a first step after or before you create the right Indexes you should remove the recursive all together. there is no reason for lopping the data when you can use it as a SET. This is where the relational database's power come to life :-)
for example check this code. I only use your first part of the code using the first 2 CTE tables. compare result.
;WITH
OrderedIn as (
select *,ROW_NUMBER() OVER (PARTITION BY Stock_ID ORDER BY TranDate) as rn
from Tran_Stock
where TxnType = 'IN'
, RunningTotals as (
select Stock_ID ,Qty, Price, Qty as Total, Cast(0 as decimal(10,2)) as PrevTotal, trandate , rn
from OrderedIn where rn = 1
union all
select
rt.Stock_ID, oi.Qty, oi.Price, Cast(rt.Total + oi.Qty as decimal(10,2))
,Cast(rt.Total as decimal(10,2))
, oi.TranDate ,oi.rn
from RunningTotals rt
inner join OrderedIn oi on rt.Stock_ID = oi.Stock_ID and rt.rn = oi.rn - 1
select * from RunningTotals
-- This will do the same as the above query
select
Stock_ID, Qty, Price
, SUM(Qty) over (PARTITION BY Stock_ID order by TranDate ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as Total
,TranDate--,TranID, TxnType
from Tran_Stock
where TxnType = 'IN'
order by Stock_ID
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
MS-Access query running very slow
Hi,
We've MS-Access application which was pointing to UDB. Now we migrated it to point Oracle DB 9.2. After migration some of the query is running very slow.
These queries used to take less than 30 seconds in UDB now taking more than 5 Minutes in Oracle.
some more obeservation :
(1) Some of the queries using "HAVING" clause without any aggregate function. When I moved this condition to "WHERE" clause, performance improved a lot.
But problem is that I can't suggest this solution to "USERS". They are creating query using "query wizard" in MS-Access and they started creating noise on this.
(2) I tested same MDB in two different PCs and same query is returning records in 4 seconds in one system, is taking more than 10 minutes in other system.
Since I'm new to MS-Access, I don't know what other information I need to provide here.
Please help me out.I have seen the problem like this,too
can i have you -
Query runs very slow and sometime freezes
Hi Experts,
I have just installed SAP GUI 710 but when i open a query in analyzer it runs very slow and if the variables are set for more than 6 months it just sits there and finally times out. It takes at least 5 minutes to open the query if it opens at all. Can you please advise me on how to resolve this issue??
Thanks, point will be awarded.Worth running RSRT .
Ravi Thothadri -
Oracle query running very slow
Hi,
We've MS-Access application which was pointing to UDB. Now we migrated it to point Oracle DB 9.2. After migration some of the query is running very slow.
These queries used to take less than 30 seconds in UDB now taking more than 5 Minutes in Oracle.
some more obeservation :
(1) Some of the queries using "HAVING" clause without any aggregate function. When I moved this condition to "WHERE" clause, performance improved a lot.
But problem is that I can't suggest this solution to "USERS". They are creating query using "query wizard" in MS-Access and they started creating noise on this.
(2) I tested same MDB in two different PCs and same query is returning records in 4 seconds in one system, is taking more than 10 minutes in other system.
Since I'm new to MS-Access, I don't know what other information I need to provide here.
Please help me out.ms wrote:
Hi All
I am using Oracle 11g . My table contains 10-12 lac rows.Do not use the word lac: it is common in the Indian sub-continent but not known much outside of
there because it is not standard English.
>
1) what is the difference between a index on one column and an index of number of columns ( i.e composite index). The obvious answer of one contains only one column and the other contains more than one.
2) For what columns in a where clause should index be created ( single columns index or composite index ).Depends
3) Also can u suggest how to improve the perfomane of thsi query?Please read: SQL and PL/SQL FAQ
which tells you how to ask a performance related question -
My Macbook pro runing very slow
HI
i have my MacBook Pro since 2012 , suddnely it runs very very slow that you can't with stand it
can you help me please ?!!Model Name: MacBook Pro
Model Identifier: MacBookPro9,2
Processor Name: Intel Core i7
Processor Speed: 2.9 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 4 MB
Memory: 8 GB -
Hello ,
I have a table like employee having more than 80 Lakhs records .
In the table there is a country column (country_name) having 234 distinct countries .
I have created index on Country_name column to make it fast .
I have created a view (employee_country) which is having distinct countries . The view is populating the country_name from employee table .
So , in the view (employee_country) have 234 distinct countries .
Now if I run select count(*) from employee_country ; then the query is taking ( 320.391 seconds ) time to show result ..
I am using one query which is taking the country_name from this view and comparing to another table with the country names .
like for example :
select ec.country_name from employee_country ec where ec.country_name not in (select cdf.country_name from country_dnb_full cdf)
I am using this query in APEX page to get the country name . But this query is very samll and taking 350.725 seconds to show the result . Therefore the APEX page when we run is showing time out error because the query is taking too much time .
I don't know why this problem is ?? I already created a index on country_name column to speed up the result . But still its not happening .
Please some one guide me where the problem is .??
Thanks
Prashant DwivediHi Prashant
First thing the view does not store any data. Its just a definition and the select query gets excuted on the original table whenever the view is referred.
Probabaly you can check for Materialized View.
Alternatively you can have a Look Up table if you think the values for the country_name is constant.
Regards
Arun -
The below Query runs very slow
SELECT
ACT1.PROJ,
ACT1.ACT,
ACT1.VER,
ACT1.DS,
ACT1.UC,
ACT1.ACT_RN,
PRED1.PRED,
PRED_DS.DS,
PRED_DS.UC01 ACT_TYPE ,
PRED1.RN,
SUCC.SUC
,SUCC.SUC_NAME
,SUCC.SUC_TYPE
,SUCC.SUCC_RN
FROM
(SELECT A.PROJ , A.VER , A.ACT , A.DS , A.UC01 UC , B.RN ACT_RN
FROM PM_PORTAL.AV_ACTIVITY A , PM_PORTAL.AV_RESREQ B
WHERE A.PROJ = B.PROJ(+)
AND A.ACT = B.ACT(+)
AND A.VER = B.VER(+)
AND A.VER = 50
AND A.PROJ LIKE 'BOM_%'
AND A.UC01 = '560'
) ACT1 ,
( SELECT A.PROJ , A.ACT , A.VER , A.PRED , B.RN
FROM PM_PORTAL.AV_RELN A , PM_PORTAL.AV_RESREQ B
WHERE A.PROJ LIKE 'BOM_%'
AND A.VER = 50
AND A.PROJ = B.PROJ(+)
AND A.PRED = B.ACT(+)
AND A.VER = B.VER(+)
) PRED1,
( SELECT DS , UC01 ,ACT ,VER , PROJ
FROM PM_PORTAL.AV_ACTIVITY
WHERE PROJ LIKE 'BOM_%'
AND VER = 50
) PRED_DS ,
(SELECT A.PROJ , A.VER , A.ACT SUC , A.PRED , B.DS SUC_NAME ,B.UC01 SUC_TYPE , C.RN SUCC_RN
FROM PM_PORTAL.AV_RELN A , PM_PORTAL.AV_ACTIVITY B , PM_PORTAL.AV_RESREQ C
WHERE A.PROJ = B.PROJ
AND A.ACT = B.ACT
AND A.VER = B.VER
AND B.PROJ = C.PROJ
AND B.ACT = C.ACT
AND B.VER = C.VER
) SUCC
WHERE ACT1.PROJ=PRED1.PROJ(+)
AND ACT1.ACT=PRED1.ACT(+)
AND ACT1.VER=PRED1.VER(+)
AND PRED1.PRED = PRED_DS.ACT
AND PRED1.PROJ = PRED_DS.PROJ
AND PRED1.VER = PRED_DS.VER
AND SUCC.PROJ = PRED1.PROJ
AND SUCC.VER = PRED1.VER
AND SUCC.PRED = PRED1.PRED
--Execution Plan
SELECT STATEMENT, GOAL = CHOOSE 293 1 337
NESTED LOOPS 293 1 337
NESTED LOOPS 290 1 305
NESTED LOOPS 287 1 242
NESTED LOOPS 282 1 206
FILTER
HASH JOIN OUTER
VIEW PM_PORTAL_READ 65 2 194
NESTED LOOPS OUTER 65 2 190
TABLE ACCESS BY INDEX ROWID TRN_ARTE AV_ACTIVITY_NPART 59 2 126
INDEX RANGE SCAN TRN_ARTE AV_ACTIVITY_1_NPART 55 2
INDEX RANGE SCAN TRN_ARTE AV_RESREQ_1_NPART 3 35 1120
VIEW PM_PORTAL_READ 210 101 4646
HASH JOIN OUTER 210 101 6868
INDEX RANGE SCAN TRN_ARTE AV_RELN_1_NPART 161 101 3636
INDEX RANGE SCAN TRN_ARTE AV_RESREQ_1_NPART 48 35 1120
TABLE ACCESS BY INDEX ROWID TRN_ARTE AV_ACTIVITY_NPART 3 56 3528
INDEX UNIQUE SCAN TRN_ARTE AV_ACTIVITY_1_NPART 2 56
INDEX RANGE SCAN TRN_ARTE AV_RELN_1_NPART 5 101 3636
TABLE ACCESS BY INDEX ROWID TRN_ARTE AV_ACTIVITY_NPART 3 56 3528
INDEX UNIQUE SCAN TRN_ARTE AV_ACTIVITY_1_NPART 2 56
INDEX RANGE SCAN TRN_ARTE AV_RESREQ_1_NPART 3 35 1120Here's the verbatim response I gave yesterday to another user also posting his SQL and asking the same question.. why is it slow?
Who says it is not already running as fast as possible?
In order to solve a problem, you need to know the problem. Stating something like 'a query is slow and should be faster' is stating an opinion - it is not describing a problem that can be resolved.
My suggestion is to turn a complex problem, into a bunch of smaller and simpler problems. If you suspect that the query could be faster, pull it apart. Test each step/component of the query in isolation. E.g. start with a single table and progressively add joins to determine what the CBO does with each additional join, what you're asking Oracle to do ito processing, and not only checking that the CBO does not make obvious errors, but that what you're asking via SQL is the best approach to get to the answer. -
Query is very slow on 10.2.0.1 Instance
Hi,
I have the following query which is taking 3 minutes 40 seconds time, can anybody help me how to reduce the time.
SELECT roorg.NAME AS team, c.con_cd AS TYPE, x.attrib_41 type2,
c.person_uid AS cif, c2.full_name AS ro,
c.full_name client_name, xm.attrib_04 issueing_country,
xm.NAME AS passport_number
FROM siebel.vw_s_contact c INNER JOIN siebel.s_contact_x x ON c.row_id =
x.par_row_id INNER JOIN siebel.s_contact_xm xm ON xm.par_row_id =
c.row_id
AND xm.TYPE =
'DOCUMENTS'
AND xm.attrib_34 =
'Card' INNER JOIN siebel.s_postn p ON p.row_id =
c.pr_postn_id INNER JOIN siebel.vw_s_contact c2 ON c2.row_id =
p.pr_emp_id INNER JOIN siebel.s_postn ropostn ON ropostn.pr_emp_id =
c2.row_id INNER JOIN siebel.s_org_ext roorg ON ropostn.ou_id =
roorg.par_row_id
WHERE xm.NAME IN (
SELECT DISTINCT NAME
FROM siebel.s_contact_xm xm
WHERE xm.TYPE = 'DOCUMENTS'
AND attrib_34 = 'Card'
AND c.active_flg = 'Y'
GROUP BY NAME
HAVING COUNT (*) > 1)
AND c.active_flg = 'Y'
ORDER BY xm.NAME
1* select * from table (dbms_xplan.display)
PLAN_TABLE_OUTPUT
Plan hash value: 2542892160
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 249 | 7989 (1)| 00:01:36 |
| 1 | SORT ORDER BY | | 1 | 249 | 7989 (1)| 00:01:36 |
| 2 | TABLE ACCESS BY INDEX ROWID | S_CONTACT_X | 1 | 28 | 1 (0)| 00:00:01
| 3 | NESTED LOOPS | | 11 | 2739 | 10 (0)| 00:00:01 |
| 4 | NESTED LOOPS | | 11 | 2431 | 9 (0)| 00:00:01 |
| 5 | NESTED LOOPS | | 208 | 31408 | 5 (0)| 00:00:01 |
| 6 | NESTED LOOPS | | 1 | 94 | 4 (0)| 00:00:01 |
| 7 | NESTED LOOPS | | 1 | 68 | 3 (0)| 00:00:01 |
| 8 | NESTED LOOPS | | 104 | 5408 | 2 (0)| 00:00:01 |
| 9 | INDEX FULL SCAN | S_POSTN_M50 | 104 | 1768 | 1 (0)| 00:00:01 |
| 10 | TABLE ACCESS BY INDEX ROWID | S_CONTACT | 1 | 35 | 1 (0)| 00:00:01 |
|* 11 | INDEX UNIQUE SCAN | S_CONTACT_P1 | 1 | | 1 (0)| 00:00:01 |
| 12 | TABLE ACCESS BY INDEX ROWID | S_POSTN | 1 | 16 | 1 (0)| 00:00:01 |
|* 13 | INDEX RANGE SCAN | S_POSTN_V1 | 1 | | 1 (0)| 00:00:01 |
| 14 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 26 | 1 (0)| 00:00:0
|* 15 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 |
|* 16 | TABLE ACCESS BY INDEX ROWID | S_CONTACT | 249 | 14193 | 1 (0)| 00:00:0
|* 17 | INDEX RANGE SCAN | S_CONTACT_V3 | 249 | | 1 (0)| 00:00:01 |
|* 18 | TABLE ACCESS BY INDEX ROWID | S_CONTACT_XM | 1 | 70 | 1 (0)| 00:00:0
|* 19 | INDEX RANGE SCAN | S_CONTACT_XM_U1 | 1 | | 1 (0)| 00:00:01 |
|* 20 | FILTER | | | | | |
| 21 | SORT GROUP BY NOSORT | | 1 | 57 | 70 (0)| 00:00:01 |
|* 22 | FILTER | | | | | |
|* 23 | TABLE ACCESS BY INDEX ROWID| S_CONTACT_XM | 838 | 47766 | 70 (0)| 00:00:01 |
|* 24 | INDEX RANGE SCAN | S_CONTACT_XM_M1 | 7510 | | 1 (0)| 00:00:01 |
|* 25 | INDEX RANGE SCAN | S_CONTACT_X_U1 | 1 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
11 - access("ROW_ID"="P"."PR_EMP_ID")
13 - access("ROPOSTN"."PR_EMP_ID"="ROW_ID")
15 - access("ROPOSTN"."OU_ID"="ROORG"."PAR_ROW_ID")
16 - filter("ACTIVE_FLG"='Y')
17 - access("P"."ROW_ID"="PR_POSTN_ID")
18 - filter("XM"."ATTRIB_34"='Card')
19 - access("XM"."PAR_ROW_ID"="ROW_ID" AND "XM"."TYPE"='DOCUMENTS')
filter( EXISTS (SELECT /*+ */ 0 FROM "SIEBEL"."S_CONTACT_XM" "XM" WHERE :B1='Y' AND
"ATTRIB_34"='Card' AND "XM"."TYPE"='DOCUMENTS' GROUP BY
"NAME" HAVING "NAME"=:B2 AND COUNT(*)>1))
20 - filter("NAME"=:B1 AND COUNT(*)>1)
22 - filter(:B1='Y')
23 - filter("ATTRIB_34"='Card')
24 - access("XM"."TYPE"='DOCUMENTS')
filter("XM"."TYPE"='DOCUMENTS')
25 - access("ROW_ID"="X"."PAR_ROW_ID")
52 rows selected.Edited by: oraDBA2 on Oct 19, 2008 2:42 PM
Edited by: oraDBA2 on Oct 19, 2008 2:46 PM
Edited by: oraDBA2 on Oct 19, 2008 2:47 PMThank Charles,
It really helped.
SELECT
roorg.NAME AS team,
c.con_cd AS TYPE,
x.attrib_41 type2,
c.person_uid AS cif,
c2.full_name AS ro,
c.full_name client_name,
xm.attrib_04 issueing_country,
xm.NAME AS passport_number
FROM
siebel.vw_s_contact c,
siebel.s_contact_x x,
siebel.s_contact_xm xm,
siebel.s_postn p,
siebel.vw_s_contact c2,
siebel.s_postn ropostn,
siebel.s_org_ext roorg
WHERE
c.row_id = x.par_row_id
AND xm.par_row_id = c.row_id
AND xm.TYPE ='DOCUMENTS'
AND xm.attrib_34 ='Card'
AND p.row_id = c.pr_postn_id
AND c2.row_id = p.pr_emp_id
AND ropostn.pr_emp_id = c2.row_id
AND ropostn.ou_id =roorg.par_row_id
AND xm.NAME IN (
SELECT DISTINCT
NAME
FROM
siebel.s_contact_xm xm
WHERE
xm.TYPE = 'DOCUMENTS'
AND attrib_34 = 'Card'
----- AND c.active_flg = 'Y'
GROUP BY
NAME
HAVING
COUNT (*) > 1)
AND c.active_flg = 'Y'
ORDER BY
xm.NAME;
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 4056642782
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 12 | 4680 | 21 (5)| 00:00:01 |
|* 1 | FILTER | | | | | |
| 2 | SORT GROUP BY | | 12 | 4680 | 21 (5)| 00:00:01 |
|* 3 | TABLE ACCESS BY INDEX ROWID | S_CONTACT_XM | 1 | 57 | 1 (0)| 00:00:01
| 4 | NESTED LOOPS | | 227 | 88530 | 20 (0)| 00:00:01 |
| 5 | NESTED LOOPS | | 227 | 75591 | 16 (0)| 00:00:01 |
| 6 | NESTED LOOPS | | 208 | 52208 | 9 (0)| 00:00:01 |
| 7 | NESTED LOOPS | | 208 | 43888 | 5 (0)| 00:00:01 |
| 8 | NESTED LOOPS | | 1 | 142 | 4 (0)| 00:00:01 |
| 9 | NESTED LOOPS | | 1 | 104 | 3 (0)| 00:00:01 |
| 10 | NESTED LOOPS | | 104 | 7904 | 2 (0)| 00:00:01 |
| 11 | INDEX FULL SCAN | S_POSTN_M50 | 104 | 3016 | 1 (0)| 00:00:01 |
| 12 | TABLE ACCESS BY INDEX ROWID| S_CONTACT | 1 | 47 | 1 (0)| 00:00:01 |
|* 13 | INDEX UNIQUE SCAN | S_CONTACT_P1 | 1 | | 1 (0)| 00:00:01 |
| 14 | TABLE ACCESS BY INDEX ROWID | S_POSTN | 1 | 28 | 1 (0)| 00:00:01 |
|* 15 | INDEX RANGE SCAN | S_POSTN_V1 | 1 | | 1 (0)| 00:00:01 |
| 16 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 38 | 1 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 |
|* 18 | TABLE ACCESS BY INDEX ROWID | S_CONTACT | 249 | 17181 | 1 (0)| 00:00:01 |
|* 19 | INDEX RANGE SCAN | S_CONTACT_V3 | 249 | | 1 (0)| 00:00:01 |
| 20 | TABLE ACCESS BY INDEX ROWID | S_CONTACT_X | 1 | 40 | 1 (0)| 00:00:01
|* 21 | INDEX RANGE SCAN | S_CONTACT_X_U1 | 1 | | 1 (0)| 00:00:01 |
|* 22 | TABLE ACCESS BY INDEX ROWID | S_CONTACT_XM | 1 | 82 | 1 (0)| 00:00:01
|* 23 | INDEX RANGE SCAN | S_CONTACT_XM_U1 | 2 | | 1 (0)| 00:00:01 |
|* 24 | INDEX RANGE SCAN | S_CONTACT_XM_M1 | 1 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter(COUNT(*)>1)
3 - filter("ATTRIB_34"='Card')
13 - access("ROW_ID"="P"."PR_EMP_ID")
15 - access("ROPOSTN"."PR_EMP_ID"="ROW_ID")
17 - access("ROPOSTN"."OU_ID"="ROORG"."PAR_ROW_ID")
18 - filter("ACTIVE_FLG"='Y')
19 - access("P"."ROW_ID"="PR_POSTN_ID")
21 - access("ROW_ID"="X"."PAR_ROW_ID")
22 - filter("XM"."ATTRIB_34"='Card')
23 - access("XM"."PAR_ROW_ID"="ROW_ID" AND "XM"."TYPE"='DOCUMENTS')
24 - access("XM"."TYPE"='DOCUMENTS' AND "XM"."NAME"="NAME")
46 rows selected.
SQL> when I removed c.active_flag='y' from sub query..now it is taking 300 msecs ...good improvement..
thanks alot..
Can you please point me to the link, where I can understand little bit more of execution plan to pin point the performance issues...
you are able to find out the problem, as i am not...it is really nice...
anyhow thanks alot
Edited by: oraDBA2 on Oct 20, 2008 3:36 PM
Edited by: oraDBA2 on Oct 20, 2008 3:38 PM -
Query is Very Slow but after using sql tuning advisor the Query is fine
Currently we have Query which takes ages to retrieve small data set of 30 seconds.So i used the sql advisor and applied the profile now the same query comes in msec.This was tested on Test enviorement.
Metadata for Table: TIBEX_PARTICIPANT
CREATE TABLE "TST_PRE_EOD"."TIBEX_PARTICIPANT"
( "PARTICIPANTID" VARCHAR2(25) NOT NULL ENABLE,
"PARTICIPANTTYPE" NUMBER(4,0),
"PARTICIPANTSUBTYPE" VARCHAR2(5),
"PARTICIPANTSTATUS" NUMBER(4,0),
"PARTICIPANTNAMESHORT" VARCHAR2(15),
"PARTICIPANTNAME" VARCHAR2(60),
"ROOTPARTICIPANTID" VARCHAR2(25),
"PARENTPARTICIPANTID" VARCHAR2(25),
"SFAREPORTING" CHAR(1),
"ADDRESSOFFICENAME" VARCHAR2(30),
"ADDRESSLINE1" VARCHAR2(60),
"ADDRESSLINE2" VARCHAR2(40),
"ADDRESSLINE3" VARCHAR2(50),
"ADDRESSLINE4" VARCHAR2(50),
"ADDRESSCOUNTRY" VARCHAR2(50),
"WEBURL" VARCHAR2(100),
"PHONENO" VARCHAR2(20),
"FAXNO" VARCHAR2(20),
"CONTACTNAME" VARCHAR2(50),
"CONTACTTITLE" VARCHAR2(30),
"CONTACTEMAIL" VARCHAR2(35),
"CURRENTOPENVAL" FLOAT(126) NOT NULL ENABLE,
"OPENVALLIMIT" FLOAT(126) NOT NULL ENABLE,
"TIMESTAMP" NUMBER(20,0) NOT NULL ENABLE,
"ORDERVALLIMIT" FLOAT(126) NOT NULL ENABLE,
"NOTE" VARCHAR2(50),
"PARTICIPANTINDEX" NUMBER(4,0),
"AUTOROUTETOCLEARING" CHAR(1),
"CREDITID" VARCHAR2(25),
"ISCPTRDDETAILS" CHAR(1) NOT NULL ENABLE,
"PRIMARY_BIC" VARCHAR2(11),
"QSID" VARCHAR2(10) NOT NULL ENABLE,
"INTERNALISEDTRADES" CHAR(1) NOT NULL ENABLE,
CONSTRAINT "XPKTIBEX_PARTICIPANT" PRIMARY KEY ("PARTICIPANTID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Table: TIBEX_QUOTE
CREATE TABLE "TST_PRE_EOD"."TIBEX_QUOTE"
( "QUOTEID" CHAR(20) NOT NULL ENABLE,
"USERORDERID" VARCHAR2(25),
"QUOTESTATUS" NUMBER(4,0) NOT NULL ENABLE,
"INDICATIVE" CHAR(1),
"BOARDID" VARCHAR2(10),
"INSTRUMENTID" VARCHAR2(50) NOT NULL ENABLE,
"SELLPRICE" FLOAT(126),
"SELLQTY" NUMBER(10,0),
"BUYPRICE" FLOAT(126),
"BUYQTY" NUMBER(10,0),
"PARTICIPANTID" VARCHAR2(25),
"ACCOUNTNO" VARCHAR2(50),
"LASTINSTRESULT" VARCHAR2(50),
"LASTINSTMESSAGESEQUENCE" NUMBER(20,0) NOT NULL ENABLE,
"BUYQUOTEMINSIZE" NUMBER(10,0),
"LASTEXECUTIONID" CHAR(20),
"SELLQUOTEMINSIZE" NUMBER(10,0),
"TICKMOVECOUNT" NUMBER(10,0),
"TIMESTAMP" NUMBER(20,0) NOT NULL ENABLE,
"SELLQTYFILLED" NUMBER(10,0),
"BUYQTYFILLED" NUMBER(10,0),
"MEID" VARCHAR2(10) NOT NULL ENABLE,
"LASTINSTREJECTCODE" VARCHAR2(10),
"LASTEXECPRICE" FLOAT(126),
"LASTEXECQTY" NUMBER(10,0),
"LASTEXECSIDE" NUMBER(4,0),
"LASTINSTTYPE" NUMBER(4,0),
"LASTEXECUTIONCOUNTERPARTY" VARCHAR2(25),
"BIDTIMESTAMP" NUMBER(20,0),
"OFFERTIMESTAMP" NUMBER(20,0),
"LASTEXECCLEARINGAGENCY" VARCHAR2(11),
"LASTEXECACCOUNTNO" VARCHAR2(50),
"LASTEXECCPCLEARINGAGENCY" VARCHAR2(11),
"LASTEXECBOARDID" VARCHAR2(10),
"MESSAGESEQUENCE" NUMBER(20,0) NOT NULL ENABLE,
"LASTINSTUSERALIAS" CHAR(4) NOT NULL ENABLE,
"PARTNEREXID" CHAR(20),
"LASTSETTLEMENTCYCLE" NUMBER(4,0),
"LASTEXECPOSTTRADEVENUETYPE" NUMBER(4,0),
"PRICELEVELPOSITION" NUMBER(4,0),
"MATCHTYPE" NUMBER(4,0),
"LASTEXECUTIONROLE" VARCHAR2(4),
"REFERENCEID" VARCHAR2(25),
"BUYMDENTRYID" VARCHAR2(13),
"SELLMDENTRYID" VARCHAR2(13),
"HALTREASON" NUMBER(4,0),
"LASTINSTFIXSEQUENCE" NUMBER(20,0)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Table: TIBEX_QUOTESTATUSENUM
CREATE TABLE "TST_PRE_EOD"."TIBEX_QUOTESTATUSENUM"
( "QUOTESTATUS" NUMBER(4,0) NOT NULL ENABLE,
"SHORTDESC" VARCHAR2(32) NOT NULL ENABLE,
"DESCRIPTION" VARCHAR2(50),
CONSTRAINT "XPKTIBEX_QUOTESTATUSENUM" PRIMARY KEY ("QUOTESTATUS")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: IX_QUOTEBOOK
CREATE INDEX "TST_PRE_EOD"."IX_QUOTEBOOK" ON "TST_PRE_EOD"."TIBEX_QUOTE" ("QUOTEID", "MESSAGESEQUENCE", "QUOTESTATUS")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: IX_QUOTE_TIMESTAMP
CREATE INDEX "TST_PRE_EOD"."IX_QUOTE_TIMESTAMP" ON "TST_PRE_EOD"."TIBEX_QUOTE" ("TIMESTAMP")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: TIBEX_PARTICIPANTQSID
CREATE INDEX "TST_PRE_EOD"."TIBEX_PARTICIPANTQSID" ON "TST_PRE_EOD"."TIBEX_PARTICIPANT" ("QSID")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: TIBEX_QUOTE_IDX_QLT
CREATE INDEX "TST_PRE_EOD"."TIBEX_QUOTE_IDX_QLT" ON "TST_PRE_EOD"."TIBEX_QUOTE" ("LASTINSTUSERALIAS", "TIMESTAMP")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: XPKTIBEX_PARTICIPANT
CREATE UNIQUE INDEX "TST_PRE_EOD"."XPKTIBEX_PARTICIPANT" ON "TST_PRE_EOD"."TIBEX_PARTICIPANT" ("PARTICIPANTID")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: XPKTIBEX_QUOTESTATUSENUM
CREATE UNIQUE INDEX "TST_PRE_EOD"."XPKTIBEX_QUOTESTATUSENUM" ON "TST_PRE_EOD"."TIBEX_QUOTESTATUSENUM" ("QUOTESTATUS")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for View: TIBEX_QUOTESBYQSIDVIEW
CREATE OR REPLACE FORCE VIEW "TST_PRE_EOD"."TIBEX_QUOTESBYQSIDVIEW" ("QUOTEID", "USERORDERID", "QUOTESTATUS", "INDICATIVE", "BOARDID", "INSTRUMENTID", "SELLPRICE", "SELLQTY", "BUYPRICE", "BUYQTY", "PARTICIPANTID", "ACCOUNTNO", "LASTINSTRESULT", "LASTINSTMESSAGESEQUENCE", "BUYQUOTEMINSIZE", "LASTEXECUTIONID", "SELLQUOTEMINSIZE", "TICKMOVECOUNT", "TIMESTAMP", "SELLQTYFILLED", "BUYQTYFILLED", "MEID", "LASTINSTREJECTCODE", "LASTEXECPRICE", "LASTEXECQTY", "LASTEXECSIDE", "LASTINSTTYPE", "LASTEXECUTIONCOUNTERPARTY", "BIDTIMESTAMP", "OFFERTIMESTAMP", "LASTEXECCLEARINGAGENCY", "LASTEXECACCOUNTNO", "LASTEXECCPCLEARINGAGENCY", "LASTEXECBOARDID", "MESSAGESEQUENCE", "LASTINSTUSERALIAS", "PARTNEREXID", "LASTSETTLEMENTCYCLE", "LASTEXECPOSTTRADEVENUETYPE", "PRICELEVELPOSITION", "MATCHTYPE", "LASTEXECUTIONROLE", "REFERENCEID", "BUYMDENTRYID", "SELLMDENTRYID", "HALTREASON", "LASTINSTFIXSEQUENCE", "QSID") AS
SELECT a.QUOTEID, a.USERORDERID, a.QUOTESTATUS, a.INDICATIVE, a.BOARDID,
a.INSTRUMENTID, a.SELLPRICE, a.SELLQTY, a.BUYPRICE, a.BUYQTY,
a.PARTICIPANTID, a.ACCOUNTNO, a.LASTINSTRESULT,
a.LASTINSTMESSAGESEQUENCE, a.BUYQUOTEMINSIZE, a.LASTEXECUTIONID,
a.SELLQUOTEMINSIZE, a.TICKMOVECOUNT, a.TIMESTAMP,
a.SELLQTYFILLED, a.BUYQTYFILLED, a.MEID, a.LASTINSTREJECTCODE,
a.LASTEXECPRICE, a.LASTEXECQTY, a.LASTEXECSIDE, a.LASTINSTTYPE,
a.LASTEXECUTIONCOUNTERPARTY, a.BIDTIMESTAMP, a.OFFERTIMESTAMP,
a.LASTEXECCLEARINGAGENCY, a.LASTEXECACCOUNTNO,
a.LASTEXECCPCLEARINGAGENCY, a.LASTEXECBOARDID,
a.MESSAGESEQUENCE, a.LASTINSTUSERALIAS, a.PARTNEREXID,
a.LASTSETTLEMENTCYCLE, a.LASTEXECPOSTTRADEVENUETYPE,
a.PRICELEVELPOSITION, a.MATCHTYPE, a.LASTEXECUTIONROLE,
a.referenceID, a.BuyMDEntryID, a.SellMDEntryID, a.haltReason,
a.lastInstFixSequence, b.QSID
FROM tibex_quote A,
tibex_Participant b
WHERE a.participantID = b.participantID
AND (A.MessageSequence, A.QuoteID) IN (
SELECT max(C.MessageSequence), C.quoteID
FROM tibex_quote C
WHERE LastInstRejectCode = 'OK'
GROUP By C.QuoteID
AND a.QuoteStatus IN (
SELECT QuoteStatus
FROM tibex_quoteStatusEnum
WHERE ShortDesc IN (
'QUO_ONMKT', 'QUO_OFFMKT', 'QUO_PREOPN'
);Tkprof in Next postTkprof Details
TKPROF: Release 10.2.0.4.0 - Production on Thu Jan 28 14:38:44 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Trace file: mifex3_ora_2598_mytrace1.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 2
Fetch 0 0.00 0.00 0 0 0 0
total 4 0.00 0.00 0 0 0 2
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 163
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 3 0.00 0.00
SQL*Net message from client 3 0.00 0.00
select text
from
view$ where rowid=:1
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.02 0 0 0 0
Fetch 2 0.00 0.00 0 4 0 2
total 6 0.00 0.02 0 4 0 2
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
1 TABLE ACCESS BY USER ROWID VIEW$ (cr=1 pr=0 pw=0 time=18 us)
SELECT quoteid, lastexecposttradevenuetype, lastexecqty, matchtype,
haltreason, buyquoteminsize, meid, lastinstuseralias, boardid,
userorderid, buymdentryid, indicative, lastinsttype, lastexecprice,
buyprice, partnerexid, lastinstresult, pricelevelposition,
lastinstrejectcode, TIMESTAMP, buyqtyfilled, referenceid,
lastexecboardid, bidtimestamp, tickmovecount, lastexecside,
offertimestamp, sellprice, participantid, lastexecutioncounterparty,
lastexecaccountno, sellmdentryid, accountno, buyqty, messagesequence,
lastexecutionid, lastexeccpclearingagency, sellqty,
lastexecclearingagency, sellquoteminsize, lastinstfixsequence,
quotestatus, lastinstmessagesequence, instrumentid, sellqtyfilled,
lastexecutionrole, lastsettlementcycle
FROM tibex_quotesbyqsidview
WHERE participantid = 'NITE'
call count cpu elapsed disk query current rows
Parse 1 0.01 0.02 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 6 21.43 20.94 1125 2405864 0 468
total 8 21.44 20.97 1125 2405864 0 468
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163
Rows Row Source Operation
468 FILTER (cr=2405864 pr=1125 pw=1125 time=20927185 us)
24523 HASH GROUP BY (cr=2405864 pr=1125 pw=1125 time=21171165 us)
2994085 TABLE ACCESS BY INDEX ROWID TIBEX_QUOTE (cr=2405864 pr=0 pw=0 time=8983645 us)
3076661 NESTED LOOPS (cr=87651 pr=0 pw=0 time=3092729 us)
24523 HASH JOIN (cr=18276 pr=0 pw=0 time=173004 us)
3 NESTED LOOPS (cr=8 pr=0 pw=0 time=81 us)
1 INDEX UNIQUE SCAN XPKTIBEX_PARTICIPANT (cr=1 pr=0 pw=0 time=18 us)(object id 168573)
3 TABLE ACCESS FULL TIBEX_QUOTESTATUSENUM (cr=7 pr=0 pw=0 time=55 us)
24523 TABLE ACCESS FULL TIBEX_QUOTE (cr=18268 pr=0 pw=0 time=122762 us)
3052137 INDEX RANGE SCAN IX_QUOTEBOOK (cr=69375 pr=0 pw=0 time=195648 us)(object id 168590)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 6 0.00 0.00
SQL*Net more data to client 46 0.00 0.00
direct path write temp 75 0.00 0.04
SQL*Net message from client 6 0.00 0.00
direct path read temp 75 0.00 0.00
DELETE FROM PLAN_TABLE
WHERE
STATEMENT_ID=:1
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.04 0 9 16 11
Fetch 0 0.00 0.00 0 0 0 0
total 4 0.00 0.04 0 9 16 11
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163
Rows Row Source Operation
0 DELETE PLAN_TABLE$ (cr=4 pr=0 pw=0 time=33 us)
0 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=30 us)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net message from client 2 0.01 0.02
SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE
NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false')
NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),0), NVL(SUM(C2),0)
FROM
(SELECT /*+ IGNORE_WHERE_CLAUSE NO_PARALLEL("PLAN_TABLE") FULL("PLAN_TABLE")
NO_PARALLEL_INDEX("PLAN_TABLE") */ 1 AS C1, CASE WHEN
"PLAN_TABLE"."STATEMENT_ID"=:B1 THEN 1 ELSE 0 END AS C2 FROM
"SYS"."PLAN_TABLE$" "PLAN_TABLE") SAMPLESUB
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 4 0 1
total 3 0.00 0.00 0 4 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 1)
Rows Row Source Operation
1 SORT AGGREGATE (cr=4 pr=0 pw=0 time=56 us)
0 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=43 us)
EXPLAIN PLAN SET STATEMENT_ID='PLUS8205116' FOR SELECT quoteid, lastexecposttradevenuetype, lastexecqty, matchtype,
haltreason, buyquoteminsize, meid, lastinstuseralias, boardid,
userorderid, buymdentryid, indicative, lastinsttype, lastexecprice,
buyprice, partnerexid, lastinstresult, pricelevelposition,
lastinstrejectcode, TIMESTAMP, buyqtyfilled, referenceid,
lastexecboardid, bidtimestamp, tickmovecount, lastexecside,
offertimestamp, sellprice, participantid, lastexecutioncounterparty,
lastexecaccountno, sellmdentryid, accountno, buyqty, messagesequence,
lastexecutionid, lastexeccpclearingagency, sellqty,
lastexecclearingagency, sellquoteminsize, lastinstfixsequence,
quotestatus, lastinstmessagesequence, instrumentid, sellqtyfilled,
lastexecutionrole, lastsettlementcycle
FROM tibex_quotesbyqsidview
WHERE participantid = 'NITE'
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.01 0.01 0 0 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163
Rows Row Source Operation
0 FILTER (cr=0 pr=0 pw=0 time=0 us)
0 HASH GROUP BY (cr=0 pr=0 pw=0 time=0 us)
0 TABLE ACCESS BY INDEX ROWID TIBEX_QUOTE (cr=0 pr=0 pw=0 time=0 us)
0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
0 INDEX UNIQUE SCAN XPKTIBEX_PARTICIPANT (cr=0 pr=0 pw=0 time=0 us)(object id 168573)
0 TABLE ACCESS FULL TIBEX_QUOTESTATUSENUM (cr=0 pr=0 pw=0 time=0 us)
0 TABLE ACCESS FULL TIBEX_QUOTE (cr=0 pr=0 pw=0 time=0 us)
0 INDEX RANGE SCAN IX_QUOTEBOOK (cr=0 pr=0 pw=0 time=0 us)(object id 168590)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
insert into plan_table (statement_id, timestamp, operation, options,
object_node, object_owner, object_name, object_instance, object_type,
search_columns, id, parent_id, position, other,optimizer, cost, cardinality,
bytes, other_tag, partition_start, partition_stop, partition_id,
distribution, cpu_cost, io_cost, temp_space, access_predicates,
filter_predicates, projection, time, qblock_name, object_alias, plan_id,
depth, remarks, other_xml )
values
(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18,:19,:20,:21,
:22,:23,:24,:25,:26,:27,:28,:29,:30,:31,:32,:33,:34,:35,:36)
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 11 0.00 0.03 0 4 16 11
Fetch 0 0.00 0.00 0 0 0 0
total 12 0.00 0.03 0 4 16 11
Misses in library cache during parse: 1
Misses in library cache during execute: 3
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 1)
SELECT ORA_PLAN_ID_SEQ$.NEXTVAL
FROM
DUAL
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 0 0 1
total 3 0.00 0.00 0 0 0 1
Misses in library cache during parse: 1
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
1 SEQUENCE ORA_PLAN_ID_SEQ$ (cr=0 pr=0 pw=0 time=18 us)
1 FAST DUAL (cr=0 pr=0 pw=0 time=2 us)
SELECT PLAN_TABLE_OUTPUT
FROM
TABLE(DBMS_XPLAN.DISPLAY('PLAN_TABLE', :1))
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 117 0 0
Fetch 2 0.00 0.00 0 0 0 28
total 4 0.00 0.00 0 117 0 28
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163
Rows Row Source Operation
28 COLLECTION ITERATOR PICKLER FETCH DISPLAY (cr=202 pr=0 pw=0 time=19391 us)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net message from client 2 0.00 0.00
SQL*Net more data to client 1 0.00 0.00
select u.name, o.name, a.interface_version#, o.obj#
from
association$ a, user$ u, obj$ o where a.obj# = :1
and a.property = :2
and a.statstype# = o.obj# and
u.user# = o.owner#
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 1 0 0
total 3 0.00 0.00 0 1 0 0
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
0 NESTED LOOPS (cr=1 pr=0 pw=0 time=32 us)
0 NESTED LOOPS (cr=1 pr=0 pw=0 time=30 us)
0 TABLE ACCESS BY INDEX ROWID ASSOCIATION$ (cr=1 pr=0 pw=0 time=27 us)
0 INDEX RANGE SCAN ASSOC1 (cr=1 pr=0 pw=0 time=23 us)(object id 387)
0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
0 TABLE ACCESS CLUSTER USER$ (cr=0 pr=0 pw=0 time=0 us)
0 INDEX UNIQUE SCAN I_USER# (cr=0 pr=0 pw=0 time=0 us)(object id 11)
SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE
NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false')
NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),:"SYS_B_0"),
NVL(SUM(C2),:"SYS_B_1")
FROM
(SELECT /*+ NO_PARALLEL("PLAN_TABLE") FULL("PLAN_TABLE")
NO_PARALLEL_INDEX("PLAN_TABLE") */ :"SYS_B_2" AS C1, :"SYS_B_3" AS C2 FROM
"SYS"."PLAN_TABLE$" "PLAN_TABLE") SAMPLESUB
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.00 0 8 0 2
total 6 0.00 0.00 0 8 0 2
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 2)
Rows Row Source Operation
1 SORT AGGREGATE (cr=4 pr=0 pw=0 time=55 us)
11 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=44 us)
select /*+ opt_param('parallel_execution_enabled',
'false') EXEC_FROM_DBMS_XPLAN */ * from PLAN_TABLE where 1=0
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 1 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 1 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 1)
Rows Row Source Operation
0 FILTER (cr=0 pr=0 pw=0 time=1 us)
0 TABLE ACCESS FULL PLAN_TABLE$ (cr=0 pr=0 pw=0 time=0 us)
SELECT /*+ opt_param('parallel_execution_enabled', 'false') */
/* EXEC_FROM_DBMS_XPLAN */ id, position, depth, operation, options, object_name, cardinality, bytes, temp_space, cost, io_cost, cpu_cost , time, partition_start, partition_stop, object_node, other_tag, distribution, projection, access_predicates, filter_predicates , other, qblock_name, object_alias, nvl(other_xml, remarks), null, null, null, null, null, null, null,
null, null, null, null, null,
null, null, null, null from PLAN_TABLE where plan_id = (select max(plan_id)
from PLAN_TABLE where id=0 and statement_id = :stmt_id)
order by id
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 2 0 0
Fetch 12 0.00 0.00 0 8 7 11
total 14 0.00 0.00 0 10 7 11
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 2)
Rows Row Source Operation
11 SORT ORDER BY (cr=8 pr=0 pw=0 time=239 us)
11 TABLE ACCESS FULL PLAN_TABLE$ (cr=8 pr=0 pw=0 time=117 us)
1 SORT AGGREGATE (cr=4 pr=0 pw=0 time=30 us)
1 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=21 us)
SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE
NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false')
NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),0), NVL(SUM(C2),0)
FROM
(SELECT /*+ IGNORE_WHERE_CLAUSE NO_PARALLEL("PLAN_TABLE") FULL("PLAN_TABLE")
NO_PARALLEL_INDEX("PLAN_TABLE") */ 1 AS C1, CASE WHEN "PLAN_TABLE"."ID"=0
AND "PLAN_TABLE"."STATEMENT_ID"=:B1 THEN 1 ELSE 0 END AS C2 FROM
"SYS"."PLAN_TABLE$" "PLAN_TABLE") SAMPLESUB
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 4 0 1
total 3 0.00 0.00 0 4 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 2)
Rows Row Source Operation
1 SORT AGGREGATE (cr=4 pr=0 pw=0 time=57 us)
11 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=44 us)
SELECT PLAN_TABLE_OUTPUT
FROM
TABLE(CAST(DBMS_XPLAN.PREPARE_RECORDS(:B1 , :B2 ) AS
SYS.DBMS_XPLAN_TYPE_TABLE))
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 5 5 28
total 2 0.00 0.00 0 5 5 28
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 1)
SELECT /*+ opt_param('parallel_execution_enabled', 'false') */
extractvalue(xmlval, '/*/info[@type = "sql_profile"]'), extractvalue(xmlval,
'/*/info[@type = "outline"]'), extractvalue(xmlval, '/*/info[@type =
"dynamic_sampling"]'), extractvalue(xmlval, '/*/info[@type =
"row_shipping"]'), extractvalue(xmlval, '/*/info[@type = "index_size"]'),
extractvalue(xmlval,'/*/info[@type = "plan_hash"]')
from
(select xmltype(:v_other_xml) xmlval from dual)
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 150 0 0
Fetch 1 0.00 0.00 0 24 0 1
total 3 0.01 0.01 0 174 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 2)
Rows Row Source Operation
1 FAST DUAL (cr=0 pr=0 pw=0 time=3 us)
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 7 0.01 0.03 0 0 0 0
Execute 7 0.01 0.04 0 126 16 13
Fetch 8 21.43 20.94 1125 2405864 0 496
total 22 21.46 21.02 1125 2405990 16 509
Misses in library cache during parse: 4
Misses in library cache during execute: 2
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 14 0.00 0.00
SQL*Net message from client 14 0.01 0.03
SQL*Net more data to client 47 0.00 0.00
direct path write temp 75 0.00 0.04
direct path read temp 75 0.00 0.00
log file sync 1 0.00 0.00
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 12 0.00 0.00 0 1 0 0
Execute 23 0.01 0.07 0 156 16 11
Fetch 22 0.00 0.00 0 58 12 47
total 57 0.02 0.08 0 215 28 58
Misses in library cache during parse: 10
Misses in library cache during execute: 10
16 user SQL statements in session.
4 internal SQL statements in session.
20 SQL statements in session.
Trace file: mifex3_ora_2598_mytrace1.trc
Trace file compatibility: 10.01.00
Sort options: default
4 sessions in tracefile.
35 user SQL statements in trace file.
9 internal SQL statements in trace file.
20 SQL statements in trace file.
16 unique SQL statements in trace file.
493 lines in trace file.
21 elapsed seconds in trace file. -
Dear All,
when I run the below query, it takes around 1 to 2 minutes.
What exact improvement can be made to increase the speed of queries on this table?
SELECT count(*),j.event_year
FROM PRC_EVENTS J
WHERE J.EVENT_TYPE_ID = 63424
AND J.E1 = '3'
and j.event_date between to_date('01-01-2011','dd-mm-rrrr') and to_date('31-12-2011','dd-mm-rrrr')
group by j.event_year;I got Result data as below in 1 or 2 minutes.....
TOTAL_ROWS EVENT_YEAR
2838 2010
33 2009
6 2007
39153 2011
2 2008explain plan for this query is
SQL> SELECT *
2 FROM TABLE(DBMS_XPLAN.DISPLAY);
PLAN_TABLE_OUTPUT
Plan hash value: 3649959670
| Id | Operation | Name | Rows | Bytes | Cost (
| 0 | SELECT STATEMENT | | 16 | 320 | 10546
| 1 | HASH GROUP BY | | 16 | 320 | 10546
|* 2 | TABLE ACCESS BY INDEX ROWID| PRC_EVENTS | 3299 | 65980 | 10545
|* 3 | INDEX SKIP SCAN | PRC_EVENTS_IDX27 | 17006 | | 2404
Predicate Information (identified by operation id):
2 - filter("JUDG"."E1"='3')
3 - access("JUDG"."EVENT_TYPE_ID"=63424 AND "JUDG"."EVENT_DATE">=TO_DATE('201
00:00:00', 'yyyy-mm-dd hh24:mi:ss') AND "JUDG"."EVENT_DATE"<=TO_DA
00:00:00', 'yyyy-mm-dd hh24:mi:ss'))
filter("JUDG"."EVENT_DATE">=TO_DATE('2011-01-01 00:00:00', 'yyyy-mm-dd
hh24:mi:ss') AND "JUDG"."EVENT_DATE"<=TO_DATE('2011-12-31 00:00:00
PLAN_TABLE_OUTPUT
hh24:mi:ss'))
21 rows selectedThe complete structure of prc_events table is as below (showing its indexes, tablespaces,triggers and all its related objects)
CREATE TABLE moj.prc_events
ID NUMBER NOT NULL,
server_id NUMBER(6) NOT NULL,
parent_id NUMBER,
event_type_id NUMBER NOT NULL,
event_year NUMBER(4),
event_no NUMBER(8),
event_date DATE NOT NULL,
hijra_date VARCHAR2(50 BYTE),
security_level_lkp NUMBER,
subject VARCHAR2(4000 BYTE) NOT NULL,
site_id NUMBER NOT NULL,
dn_site_type_id NUMBER NOT NULL,
wrksec_id_created_by NUMBER NOT NULL,
remarks VARCHAR2(1000 BYTE),
signed_onbehalf_prefix VARCHAR2(80 BYTE),
signed_by_prefix VARCHAR2(80 BYTE),
signed_position_desc VARCHAR2(240 BYTE),
signed_by_id NUMBER,
signed_onbehalf_by_id NUMBER,
signed_position_id NUMBER,
certify_date DATE,
certify_user VARCHAR2(30 BYTE),
execution_date DATE,
execution_user VARCHAR2(30 BYTE),
eligibility_check_flag VARCHAR2(1 BYTE) NOT NULL,
eligibility_executed_flag VARCHAR2(1 BYTE) NOT NULL,
flex_ref_no NUMBER,
attachment_link_no NUMBER,
audit_trail_no NUMBER,
created_by VARCHAR2(30 BYTE) NOT NULL,
creation_date DATE NOT NULL,
last_updated_by VARCHAR2(30 BYTE) NOT NULL,
last_update_date DATE NOT NULL,
e1 VARCHAR2(255 BYTE),
e2 VARCHAR2(255 BYTE),
e3 VARCHAR2(255 BYTE),
e4 VARCHAR2(255 BYTE),
e5 VARCHAR2(255 BYTE),
e6 VARCHAR2(255 BYTE),
e7 VARCHAR2(255 BYTE),
e8 VARCHAR2(255 BYTE),
e9 VARCHAR2(255 BYTE),
e10 VARCHAR2(255 BYTE),
e11 VARCHAR2(255 BYTE),
e12 VARCHAR2(255 BYTE),
e13 VARCHAR2(255 BYTE),
e14 VARCHAR2(255 BYTE),
e15 VARCHAR2(255 BYTE),
event_status_lkp NUMBER,
e16 VARCHAR2(255 BYTE),
e17 VARCHAR2(255 BYTE),
e18 VARCHAR2(255 BYTE),
e19 VARCHAR2(255 BYTE),
e20 VARCHAR2(255 BYTE),
e21 VARCHAR2(255 BYTE),
e22 VARCHAR2(255 BYTE),
e23 VARCHAR2(255 BYTE),
e24 VARCHAR2(255 BYTE),
e25 VARCHAR2(255 BYTE),
executable_trans_flag VARCHAR2(1 BYTE) NOT NULL,
record_status_lkp NUMBER,
parent_type_id NUMBER,
nd_parent_id NUMBER,
dn_event_type_code VARCHAR2(30 BYTE),
status_date DATE,
long_e1 VARCHAR2(4000 BYTE),
long_e2 VARCHAR2(4000 BYTE),
long_e3 VARCHAR2(4000 BYTE),
dn_owner_party_person_id NUMBER,
e26 VARCHAR2(255 BYTE),
e27 VARCHAR2(255 BYTE),
e28 VARCHAR2(255 BYTE),
e29 VARCHAR2(255 BYTE),
e30 VARCHAR2(255 BYTE),
dn_business_class_lkp NUMBER NOT NULL,
dn_event_class_lkp NUMBER NOT NULL,
security_class_lkp NUMBER NOT NULL,
site_no NUMBER(4) NOT NULL,
long_e4 VARCHAR2(4000 BYTE),
long_e5 VARCHAR2(4000 BYTE),
long_e6 VARCHAR2(4000 BYTE),
long_e7 VARCHAR2(4000 BYTE),
long_e8 VARCHAR2(4000 BYTE),
web_request_id NUMBER,
attached_topic_id NUMBER,
adult_flag VARCHAR2(1 BYTE),
dn_location_id NUMBER,
dn_loc_staff_id NUMBER,
dn_receive_date DATE,
receive_flag VARCHAR2(1 BYTE),
ll_parent_id NUMBER,
ll_object_id NUMBER,
io_type NUMBER(2),
io_id NUMBER(12),
io_out_seq NUMBER,
file_name VARCHAR2(256 BYTE),
send_police_org_unit_id NUMBER,
io_timestamp DATE,
inves_no NUMBER,
inves_year NUMBER,
event_no_sno NUMBER,
prc_unit_id NUMBER,
document_flag VARCHAR2(2 BYTE),
copy_serial NUMBER,
machine_name VARCHAR2(255 BYTE),
hearing_date DATE
TABLESPACE ts16k_data
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1414 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
CREATE INDEX moj.dn_location_id_idx ON moj.prc_events
(dn_location_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 47 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.dn_loc_staff_id_idx ON moj.prc_events
(dn_loc_staff_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 21 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.e1_indx ON moj.prc_events
(e1)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 20 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.e4_indx ON moj.prc_events
(e4)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 18 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.env_server_id_i ON moj.prc_events
(server_id)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 49 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.env_wrksec_i ON moj.prc_events
(wrksec_id_created_by)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 51 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.event_no_sno_i ON moj.prc_events
(event_no_sno)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 128 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.event_status_i ON moj.prc_events
(event_status_lkp)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 11 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_date ON moj.prc_events
(event_date)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 72 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_date_year_no_idx ON moj.prc_events
(event_date, event_year, event_no)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 89 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_evn_typ_i ON moj.prc_events
(event_type_id)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 56 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_nd_parent_fk_i ON moj.prc_events
(nd_parent_id)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 17 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_parent_appcmp_fk_i ON moj.prc_events
(parent_type_id)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 42 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE UNIQUE INDEX moj.evn_pk_i ON moj.prc_events
(ID)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 57 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_prnt_i ON moj.prc_events
(parent_id)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 41 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_prt_prs_i ON moj.prc_events
(dn_owner_party_person_id)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 14 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_site_i ON moj.prc_events
(site_id)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 49 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evnt_sngdbyid_indx ON moj.prc_events
(signed_by_id)
LOGGING
TABLESPACE moj_data
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 21600 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evnt_sngonhkbyid_indx ON moj.prc_events
(signed_onbehalf_by_id)
LOGGING
TABLESPACE moj_data
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 864 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.evn_year_no_i ON moj.prc_events
(event_year, event_no)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 58 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.i1 ON moj.prc_events
(dn_event_type_code)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 75 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.i2 ON moj.prc_events
(security_class_lkp)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 53 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.ix1 ON moj.prc_events
(event_type_id, e5, event_date, event_year)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 104 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL
COMPRESS 2;
CREATE INDEX moj.ix2 ON moj.prc_events
(e4, dn_event_type_code)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 72 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL
COMPRESS 1;
CREATE INDEX moj.ix6 ON moj.prc_events
(event_type_id, event_year, event_no)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 53 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL
COMPRESS 2;
CREATE INDEX moj.prc_event_idx1 ON moj.prc_events
(e25, event_type_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 72 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx10 ON moj.prc_events
(event_type_id, security_class_lkp, event_date)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 122 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx11 ON moj.prc_events
(e4, dn_event_type_code, e5)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 108 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx12 ON moj.prc_events
(event_no, event_year)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 82 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx13 ON moj.prc_events
(subject)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 128 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx14 ON moj.prc_events
(e13, event_type_id, long_e1)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 190 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx15 ON moj.prc_events
(event_type_id, ID)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 112 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx16 ON moj.prc_events
(dn_event_class_lkp)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 56 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx17 ON moj.prc_events
(e26, event_type_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 80 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx18 ON moj.prc_events
(e16, event_type_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 72 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx19 ON moj.prc_events
(created_by)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 76 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx2 ON moj.prc_events
(e25, event_type_id, e26)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 89 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx20 ON moj.prc_events
(event_type_id, security_class_lkp, TO_NUMBER(TO_CHAR("EVENT_YEAR")))
LOGGING
TABLESPACE indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx21 ON moj.prc_events
(dn_owner_party_person_id, event_status_lkp, event_type_id)
LOGGING
TABLESPACE indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx22 ON moj.prc_events
(event_type_id, prc_unit_id, e5, event_date)
LOGGING
TABLESPACE indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx23 ON moj.prc_events
(event_type_id, e5)
LOGGING
TABLESPACE indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx24 ON moj.prc_events
(event_type_id, security_class_lkp, e5)
LOGGING
TABLESPACE indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx25 ON moj.prc_events
(ID, event_year)
LOGGING
TABLESPACE indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx3 ON moj.prc_events
(event_type_id, parent_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 80 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx4 ON moj.prc_events
(event_type_id, prc_unit_id, event_date)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 100 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx5 ON moj.prc_events
(status_date, event_type_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 91 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx6 ON moj.prc_events
(e4, event_type_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 81 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx7 ON moj.prc_events
(e15, event_type_id, e18)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 88 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx8 ON moj.prc_events
(e15, event_type_id, e18, e12)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 94 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_idx9 ON moj.prc_events
(event_no, dn_event_type_code, event_year, e5, e4)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 136 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_event_io_timestamp_idx ON moj.prc_events
(io_timestamp)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 10 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_events_e5_i ON moj.prc_events
(e5)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 28 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_events_idx27 ON moj.prc_events
(event_type_id, event_status_lkp, event_date)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.prc_unit_id_indx ON moj.prc_events
(prc_unit_id)
NOLOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 53 m
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX moj.signed_position_idx ON moj.prc_events
(signed_position_id)
LOGGING
TABLESPACE ts16k_indx
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64 k
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
ALTER TABLE moj.prc_events ADD (
CONSTRAINT evn_evn_fk
FOREIGN KEY (parent_id)
REFERENCES moj.prc_events (ID),
CONSTRAINT evn_evn_ndirect_prnt_fk
FOREIGN KEY (nd_parent_id)
REFERENCES moj.prc_events (ID),
CONSTRAINT evn_org_unt_fk
FOREIGN KEY (site_id)
REFERENCES moj.env_organization_units (ID),
CONSTRAINT evn_parent_typ_appcmp_fk
FOREIGN KEY (parent_type_id)
REFERENCES base_2000.bsh_application_components (ID),
CONSTRAINT evn_prt_prs_fk
FOREIGN KEY (dn_owner_party_person_id)
REFERENCES moj.env_persons_table (ID),
CONSTRAINT evn_signed_fk
FOREIGN KEY (signed_by_id)
REFERENCES moj.env_persons_table (ID),
CONSTRAINT evn_signed_onbehalf_fk
FOREIGN KEY (signed_onbehalf_by_id)
REFERENCES moj.env_persons_table (ID),
CONSTRAINT evn_signed_pos_fk
FOREIGN KEY (signed_position_id)
REFERENCES moj.env_positions (ID),
CONSTRAINT evn_typ_appcmp_fk
FOREIGN KEY (event_type_id)
REFERENCES base_2000.bsh_application_components (ID));
GRANT DELETE, INSERT, SELECT, UPDATE ON moj.prc_events TO base_2000_role;
GRANT DELETE, INSERT, SELECT, UPDATE ON moj.prc_events TO moj_role;Please note that this table is having around 8 million rows and many other queries are slow on this table especially in case of self joins. Further all transactions are saving in this table and also the child transactions and child of the child transactions therefore normally we have to select this table mutiple times in the FROM CLAUSE LIKE887419 wrote:
Yes there are dozens of indexes. I also don't like this table structure, no normalization. Actually this one table should be 10 are more tables but unfortunately, what I can do now because a big application is based on this ugly design.You could normalise this table and put a view in place to recreate the table structure as it stands now, that way you wouldn't break the application from a query point of view. You could also add INSTEAD OF triggers to allow inserts, updates and deletes and redirect them to the new normalised structures.
>
Will table partitioning will work for this table.It might do, or it might make things worse. You need to identify a key that is used in all or the vast majority of queries to partition by. Event date might be one, but then again it might not. Another could be event type id, or a category of some type, but if it's only used in a handful of queries you run the risk of slowing all the other queries down to speed your one up.
user6806750 already mentioned that you could create a new index just to service your query
maybe something like
CREATE INDEX xyz on PRC_EVENTS
( event_type_id,
e1,
event_date,
event_year
/Have you looked at index monitoring to see which of these indexes is actually being used? You've got lots of indexes on individual columns and it might be that you can combine quite a number of them into composite indexes that can serve more than one query.
HTH
David -
Hi I have a sql query report that is taking very long to render.The query on sql developer comes back in less than a second.Any ideas on what could be wrong?
Hi
When posting code on the forum, put {noformat}{noformat} (with the curly brackets and the word code in lowercase) above and below your code like this...
{noformat}{noformat}
SELECT *
FROM emp
{noformat}{noformat}
It will then appear like this, preserving formatting...SELECT *
FROM emp
Next, how many rows are returned in total, it may be that you have SQL Developer set up to fetch only the first x number of rows?
Why have you put a CHOOSE hint in there?
Is it a classic report or an interactive report?
It looks like you're going over a database link, you really need to provide an explain plan (formatted as I have detailed above), a DRIVING_SITE hint may help you but it's impossible to know without seeing the plan...
Cheers
Ben -
Insert query is very slow on prod but is very fast on the local
Hi,
An insert statement ( bulk insert..) takes around 45 minutes to insert 25,000 records in prod but the same in our local env( local env is a copy of production) takes 3 minutes for inserting 1,50,000 records . This is a very huge difference. The explain plan of queries on both the env is same. The query is a simple join between a GTT ( 25,000) and a normal table ( with 10 records).
I still dont have the trace for the query from prod . The database version on prod is 11.1.7 and the version on local is 11.1.6
In the mean time while I wait for the trace it would be really helpfu If any of you can let me know the parameters /next steps that should be followed. I have compared the session level parameters on both the env and its the same.
Thanks in advance
KevinLook for cost, bytes, and rows. These numbers can be off-base since they're estimates, but I'm wondering if the values are the same on both systems. Different values could mean the CBO is interpreting the data as having different characteristics. "almost the same" could suggest the CBO is making different decisions - not all operations are listed in execution plans. For instance, I've seen sort operations taking place from V$SESSION_LONGOPS when no sort was directly listed in an execution plan.
I was hoping you could get wait information from the 10046 trace :(
Maybe you are looking for
-
FICO : Asset Accounting - Depreciation Run Issue
Dear Friends, I have an issue in asset accounting. Let me explain the actual background of this issue. 1. I created a new company code(2000) by copying the existing one(1000 along with the closed year 2009 2. After that when i was trying to post acqu
-
MMy iPhone has the wrong I'd in the iCloud settting and it keeps coming on and asking for a pass word that doesn't exist and neither does the id So what to do to get rid of it because I can't use my phone! It won't let me do anything
-
I want to send email from jsp,
i want to send email from jsp, i dont know smtp:host, how to send mail? plz carify this doubt sir.
-
Chinese characters copying incorrectly when saving pdfs with Preview
So this is a very strange problem. When I save a .pdf that I have annotated in Preview, it saves fine and everything continues to display correctly. However, if I then try to copy Chinese characters from the pdf, it pastes gibberish. F'rex: 灿烂辉煌 beco
-
I am in India and i haven't received the amber update till yet. Why??