Query Executing very slow.............

Hi All,
The below query takes long time to execute. Please review this and provide me the better solution by which i can get the faster result .
I have created the index in the txnlog table on timestamp,serialno, and in alt_merchant am on alt_merchantno and in txnlog_overrun on merchantno.
SELECT t.timestamp,t.wicno,t.merchantno,u.overrun_amount,NVL(ad.state,'N/A')
FROM txnlog t,txnlog_overrun u,alt_merchant am,address ad
WHERE t.timestamp > SYSDATE -15
AND t.timestamp=u.timestamp(+)
AND t.serialno=u.serialno(+)
AND t.wicno=am.alt_merchantno(+)
AND t.merchantno=am.merchantno(+)
AND am.ADDRESSID=ad.addressid(+)
Txnlog having millions of records.
Regards,
Nitesh

Have you tried tracing the session and using tkprof on the resulting trace file?
EXECUTE dbms_support.start_trace_in_session (<sid>,<serial#>,binds=>true,waits=>true);
Then execute the query.
You can find more information about SQL Trace and TKPROF at the following link.
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm

Similar Messages

  • 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

  • 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

  • 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

  • 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]

  • Forms executable files execute very slow

    I am using AS10g form services. But the form applet which executes at the client is very slow as compared to the previous version of forms like 6i
    Data Entry is time comsuming, coz the applet taked time to open an LOV and in other operations.
    Is there any way to speed up this process?

    Forms 10g run as a Java applet in the browser. Java takes more resources on a PC than Forms 6i (client/server). Check your PC if you need more memory.
    Also, check the Jinitiator cache settings.

  • SQL Query is very slow

    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 Dwivedi

    Hi 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

  • Executable very slow

    Good afternoon,
    I have an application with 130 Mb which is working naked
    multimedia kiosk but this very slow, there is a way to make it
    faster? Click a button with a finger and so last 5 seconds is that
    responds ...
    Thank you and sorry for my English

    mpinto_ wrote:
    > Good afternoon,
    >
    > I have an application with 130 Mb which is working naked
    multimedia kiosk but
    > this very slow, there is a way to make it faster? Click
    a button with a finger
    > and so last 5 seconds is that responds ...
    > Thank you and sorry for my English
    Hi,
    Is the application 130MB in total or a single file? If it's a
    single file, it does
    sound large and I'd suggest it be broken into smaller
    components that can be
    linked to each other. There may be other ways your
    application can be optimized
    for better playback. Could you describe in more detail
    exactly what you have in
    your application (images, video etc.)
    regards
    Dean
    Director Lecturer / Consultant / Director Enthusiast
    http://www.fbe.unsw.edu.au/learning/director
    http://www.multimediacreative.com.au
    email: [email protected]

  • Why oracle spatial query execute so slow???

    hi all,
    I have two oracle spatial table CHI_2007r2 and CHI_2008r2, each table has it's own spatial index,and each table has 2000 row record, Now execute this query,I can get the result soon,
    select /*+ ORDERED */ a.link_id from chi_2007r2 a,chi_2008r2 b where a.link_id=b.link_id and sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';
    But I execute the query by geom only,it will take so long time! query(3 more hours):
    select /*+ ORDERED */ a.link_id,b.link_id from chi_2007r2 a,chi_2008r2 b where sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';
    I don't upderstand...
    thanks
    David

    Because in the first statement
    select /*+ ORDERED */ a.link_id from chi_2007r2 a,chi_2008r2 b where a.link_id=b.link_id and sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE'; you are joining the two tables while in the second statement
    select /*+ ORDERED */ a.link_id,b.link_id from chi_2007r2 a,chi_2008r2 b where sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';you are doing a cartesian merge first because there is no join between a and b other than te sdo_relate which will be calculated for every row combination you get.
    But I think you'd be better off posting in the {forum:id=76} forum.
    Best regards,
    PP
    Edited by: porzer on Jan 15, 2009 10:34 AM

  • Oracle 10g - query is very slow in jdbc but not in other tools

    I'm using PreparedStatement to execute a query with some parameters.
    in sql developer, it just spends 12 seconds but in jdbc, it's around 140 seconds.
    I disabled "_optim_peek_user_binds" parameter already but it didn't help.
    alter session set "_optim_peek_user_binds"=false;

    Please mark this thread ANSWERED and repost it in the JDBC forum.
    https://forums.oracle.com/forums/category.jspa?categoryID=288
    When you post provide your 4 digit Oracle version, Java version and JDBC jar name and version as well as the code you are using.

  • 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 post

    Tkprof 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.

  • Query is very slow

    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 LIKE

    887419 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

  • Query Running very slow.............

    Hi All,
    The below query takes long time to execute. Please review this and provide me the better solution by which i can get the faster result .
    I have created the index in the txnlog table on timestamp,serialno, and in alt_merchant am on alt_merchantno and in txnlog_overrun on merchantno.
    SELECT t.timestamp,t.wicno,t.merchantno,u.overrun_amount,NVL(ad.state,'N/A')
    FROM txnlog t,txnlog_overrun u,alt_merchant am,address ad
    WHERE t.timestamp > SYSDATE -15
    AND t.timestamp=u.timestamp(+)
    AND t.serialno=u.serialno(+)
    AND t.wicno=am.alt_merchantno(+)
    AND t.merchantno=am.merchantno(+)
    AND am.ADDRESSID=ad.addressid(+)
    Txnlog having millions of records.
    Regards,
    Nitesh

    Hello
    SELECT NUM_ROWS, BLOCKS, EMPTY_BLOCKS, AVG_ROW_LEN FROM >USER_TABLES WHERE TABLE_NAME ='TXNLOG';
    Returns Null for all columns.This suggests to me that statistics are missing. Have you generated them as I suggested? Could you post the execution plan here:
    tylerd@DEV2> set pages 50000
    tylerd@DEV2> set lines 200
    tylerd@DEV2> EXPLAIN PLAN FOR
      2  select * from dual
      3  /
    Explained.
    tylerd@DEV2> SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 272002086
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
    8 rows selected.David

  • SQL server 2000 Procedure executing very slower in SQL 2012

     
    Hi,
    I've migrated my database from SQL 2000 to SQL 2012 using SQL2008 as intermediate. After migration, I found that one of my procedure is timing out from web site. When I run that procedure in Management Studio, it takes 42 seconds to display result. The same
    query is executed in 3 seconds in SQL 2000 version (in first run it takes 10 seconds in SQL 2000 and second run it took 3 seconds only). But in SQL 2012 second and third time also it took 36 seconds. Can anyone explain why the query takes longer time instead
    of less time after the upgrade? 
    Our prod deployment date is approaching so any quick help is appreciated. 
    Thanks in advance.

    You need to compare the execution plans of queries running in 2000 and 2012 to pin point why there is a difference.
    However, have you made sure that you have reindexed the indexes and updated the stats and you still see the difference? If not, please do that and test again.
    Could you post the execution plans?
    Also read this -
    http://blogs.msdn.com/b/psssql/archive/2015/01/30/frequently-used-knobs-to-tune-a-busy-sql-server.aspx
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

Maybe you are looking for

  • Receiver SOAP Adapter Problem-soap fault: Server did not recognize the valu

    I have a scenario for service orders using async call : IDOC-XI-SOAP. I used the XML Spy tool to test the Service order's web services and it works fine. I imported the same WSDL file in XI. When I send a SOAP message from XI, I get a following error

  • HT1657 can I watch a rented movie offline

    i have rented several movies to try to watch on a flight, when I won't have access to wifi.  Is this possible? I think I've done it before, but I can't seem to make it work this time

  • Oc4j server

    Hi, I have a problem to run my jsp page.The project was running properly in other machine using the same server(oc4j server).when i run the test jsp page,i got following error message: 500 Internal Server Error OracleJSP: oracle.jsp.parse.JspParseExc

  • Design View is black

    After adding my site to CS4, the Design View of all pages is black. Code View works. Live View works. It's only Design View that's giving me trouble. Without Design View, Dreamweaver is useless to people like me who aren't proficient in code. I've tr

  • Serious problem with AppStore/iTunes WiFi Store. Cannot connect

    Hi I has a serious problem with my iPod Touch: When I tries to open App Store on my iTouch, I usually gets this message: *"Cannot connect to iTunes Store"*, often followed by *"Cannot retrieve download information. Please connect with iTunes."*. iTun