Tuning Greater than predicate query on dates

Hi,
I have the below query which is doing FTS and is very expensive causing load to timeout.
I did my analysis and found that table is having large number of records and hence FTS is taking long time causing timeout from app side.
I proposed to have this table partitioned but this is still pending with business and they in meantime want some solution other solution to fix this issue.
below is the query and plan
SELECT TRANSACTION_LOG.ID, TRANSACTION_LOG.USER_IDENTIFIER, TRANSACTION_LOG.START_TIME, TRANSACTION_LOG.END_TIME, TRANSACTION_LOG.REQUEST, TRANSACTION_LOG.RESPONSE
FROM
WP61PD1COLTRDB.TRANSACTION_LOG
WHERE TRANSACTION_LOG.END_TIME > TO_DATE('07/26/2012 10:16:41','MM/DD/YYYY hh24:mi:ss')
Plan hash value: 2462480644
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5 | 5360 | 1480K (1)| 04:56:09 |
|* 1 | TABLE ACCESS FULL| TRANSACTION_LOG | 5 | 5360 | 1480K (1)| 04:56:09 |
Predicate Information (identified by operation id):
1 - filter("TRANSACTION_LOG"."END_TIME">TIMESTAMP' 2012-07-26 10:16:41')
Count of no. of records:
select count(*) from WP61PD1COLTRDB.TRANSACTION_LOG
COUNT(*)
43537767
There is only one index on ID column of the table which is normal index.
desc WP61PD1COLTRDB.TRANSACTION_LOG
Name Null Type
ID NOT NULL NUMBER(38)
USER_IDENTIFIER NOT NULL VARCHAR2(255)
CLIENT_IP_ADDRESS VARCHAR2(255)
START_TIME NOT NULL TIMESTAMP(6)
END_TIME NOT NULL TIMESTAMP(6)
REQUEST NOT NULL VARCHAR2(4000)
RESPONSE VARCHAR2(4000)
Is there any other way we can tune this query?
Thanks
JP

Please read the FAQ for how to post a tuning request and the information that is needed (e.g. table and index ddl, record counts for the tables, record counts for the predicates in the where clause)
>
I have the below query which is doing FTS and is very expensive causing load to timeout.
>
Just how can a SELECT query cause a 'load' to timeout?
>
Is there any other way we can tune this query?
>
There is no way to know since you didn't provide any information about how many records there are in the table and how many might satisfy the date predicate you are using.
Other than doing the query in parallel you can't speed it up unless there was an index on END_TIME that could be used effectively.
Even with an index on that column a full table scan that does multi-block reads might be lower cost than using the index and doing single-block reads.
If the table has 100 million records and your query is trying to return 99 million of them don't you think a full table scan should be used?

Similar Messages

  • Post park ivoice M8079 'Reversal value greater than value invoiced to date'

    I create a Service purchase order number is 8200000747 in our products system, and service entry sheet number is 1000026152, material document number is 5000306476.
    When I create a park invoice reference this Service PO, the system can not clear GR/IR account with that service entry sheet(1000026152). When we want to post this park invoice, system generate message M8079 'Reversal value greater than value invoiced to date'. But, this item never been verification invoice , I can find this not cleared  GR/IR data in MR11, this item not a multi account assignment , no foreign currency.
    What happened? How can I carry out the correct GR/IR account data in park invoice?

    Hello,
    Instead of reversing the invoice try posting the Credit Memo through MIRO .
    Regards
    Mahesh

  • Can't add numbers greater than 100 in the Data Editor for a column chart

    I'm trying to create a column chart in Keynote '09 but every time I add a data point with a value greater than 100 in the Data Editor it turns the number into a date. I have the Y Axis set to "Number" and it works fine for numbers less than 100 but I want to show a graph that goes from 0 - 1000. Is this happening to anyone else?
    Chart Settings:
    Y Axis Options:
    - Max = 1000
    - Steps = 5
    - Format = Number
    X Axis Options
    - Show Axis
    - Show Categories
    - No Tick Marks
    thanks in advance for the help

    Welcome to the discussions, AlexEberts.
    No, it's not happening for me. This is what I'm doing
    1) Insert -> Chart -> Column
    2) In the Data editor, for 2007, I enter 110.
    The chart automatically expands to 110 (because, by default, it's set to autosize the Y-axis)
    Does this work for you? If it does, then we can look at why it doesn't work when you add parameters.

  • Goods receipt date should be greater than the P.O. date

    Hi
    Is there any option to control the Goods receipt date should not be lesser than the P.O.Date??
    Eg: P.O. is raised in 10.1.9, User should not do the GRN before 10.1.9. In which way we can control  this???
    Regards
    Ravi

    Dear,
    You have to include User exit in MIGOwhich will trhrow an error at the time when Goods receipt date is greater than the P.O. date.
    Regards
    Utsav

  • Report data showing a date 1 day greater than selection formula end date

    Hi All,
       I have a report that contains the following selection:
    date(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) >= date(minimum({?Date})) and date(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) <= date(maximum({?Date})) and dayofweek(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) in {?DayOfWeek} and
        time(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) >= time({?Start Time}) and
        time(dateadd("h",-{Calendar.EstUTCOffset}, {tbl.TimeStamp})) < time({?End Time})
    When I view the report, if my date(maximum({?Date}))  is 5/1/2011, the report shows data for 5/2/2011. I can't seem to figure out why my report is generating data for a date that is 1 day greater than my end date.
    Any suggestions would be appreciated.
    Thank you in advance,

    No need to send SQL as dates are not in WHERE clause.
    It someting to do with the way crystal handles datetimes
    If you want to see dates up to an including 6/2/2011 if its a date time crystal will create a where caluse
    Datetimefield <= 6/3/2011 00:00:00
    Looks like when this is converted to date its stayin as 6/3/2011
    Sorry can't think of any solutions, also I live in UK so just about to leave, hopefully some one else may be able to offer a solution.
    Ian

  • Less Than operator not working, Greater Than operator works comparing dates

    I need to compare dates to conditionally display a row. If the DateDueJulian_ID5<= AsOfDate_ID47 display otherwise don't. I get all rows but if I reverse the logic >= the condition works and only displays the one matching row.
    I am using the Template Builder 10.1.3.4.1 and WORD 2007.
    Any help is appreciated!
    Thanks
    XML Source:
    <Header_Section_S3>
    <Delinquency_Report_ID225>DELINQUENCY NOTICE</Delinquency_Report_ID225>
    <VersionName_ID270>0001</VersionName_ID270>
    <Report_or_Video_Title_ID53></Report_or_Video_Title_ID53>
    <Remit_To_Text_ID68>Remit To:</Remit_To_Text_ID68>
    <RemitToAddressLine1_ID2>XXXXX</RemitToAddressLine1_ID2>
    <XX_XX_XX_ID259>2010-08-25</XX_XX_XX_ID259>
    <Date__ID258>Date</Date__ID258>
    <RemitToAddressLine2_ID5></RemitToAddressLine2_ID5>
    <RemitToAddressLine3_ID8></RemitToAddressLine3_ID8>
    <As_of_Date__ID46>As of Date</As_of_Date__ID46>
    <AsOfDate_ID47>2007-11-29</AsOfDate_ID47>
    <A_R_Delinquency_Notice_Detail_Join_S2>
    <DocVoucherInvoiceE_ID1>1897265</DocVoucherInvoiceE_ID1>
    <DateInvoiceJ_ID3>2007-10-11</DateInvoiceJ_ID3>
    <DateDueJulian_ID5>2007-12-10</DateDueJulian_ID5>
    <NameRemark_ID7></NameRemark_ID7>
    <AmountOpen_ID11></AmountOpen_ID11>
    <AddressNumber_ID17></AddressNumber_ID17>
    <UniqueKeyIDInternal_ID19></UniqueKeyIDInternal_ID19>
    <KAV_CustomerPONumber_ID23></KAV_CustomerPONumber_ID23>
    </A_R_Delinquency_Notice_Detail_Join_S2>
    <A_R_Delinquency_Notice_Detail_Join_S2>
    <DocVoucherInvoiceE_ID1>1897265</DocVoucherInvoiceE_ID1>
    <DateInvoiceJ_ID3>2007-10-11</DateInvoiceJ_ID3>
    <DateDueJulian_ID5>2007-11-10</DateDueJulian_ID5>
    <NameRemark_ID7></NameRemark_ID7>
    <AmountOpen_ID11></AmountOpen_ID11>
    <AddressNumber_ID17></AddressNumber_ID17>
    <UniqueKeyIDInternal_ID19></UniqueKeyIDInternal_ID19>
    <KAV_CustomerPONumber_ID23></KAV_CustomerPONumber_ID23>
    </A_R_Delinquency_Notice_Detail_Join_S2>
    RTF:
    <?for-each:Header_Section_S3?>
    <?if:DateDueJulian_ID5 <= AsOfDate_ID47?>
    <?DocVoucherInvoiceE_ID1?>
    <?DateDueJulian_ID5?>
    <?AsOfDate_ID47?>
    <?end if?>
    <?end for-each?>

    Found the solution! Use Date_Diff.
    <?if:xdoxslt:date_diff('d',DateDueJulian_ID5,AsOfDate_ID47,$_XDOLOCALE,$_XDOTIMEZONE)>=0?>

  • GR posting date always greater than PO document date.

    Dear SAP Gurus,
    Am working on below requirement in a support project..
    Need to ensure GR posting date always greater than in PO creation date. Only current month is open for GR posting and at present as a standard system allows to post GR any date in the current open period.
    Is there any way, we can control the same via messages without implementing any exits or badis.
    Appreciate immediate response.
    Regards,
    GM

    there is no std sap for this
    you can use user exit to ful fill ur requirement
    in that u can write a code where is u can check all PO dated in GR must be eq to or less than GR posting and document date
    hope this helps

  • Camel Query : Calender list : Get Items agains given date that must be greater than and eqaul to start date and greater less than or equal to end date ?

    Camel Query : Calender list : Get Items agains given date that must be greater than and eqaul to start date and greater less than or equal to end date ?
    A Snap of Employee holiday list
    Case : Anne juul Sondergaar is on leave from 05-06-2014 to 07-06-2014
    I need a query to check wheither Anne juul is on leave at 06-06-2014 ????
    I am using this query that return nothing
    SPQueryquery =
    newSPQuery();
                                query.Query =
    @"<Where>
    <And>
    <And>
    <Leq>
    <FieldRef Name='Til' />
    <Value Type='DateTime'>"
    + WorkingStartDate.ToString("yyyy-MM-dd")
    + @"</Value>
    </Leq>
    <Geq>
    <FieldRef Name='Fra' />
    <Value Type='DateTime'>"
    + WorkingStartDate.ToString("yyyy-MM-dd")
    + @"</Value>
    </Geq>
    </And>
    <Eq>
    <FieldRef Name='Medarbejdere' />
    <Value Type='Lookup'>"
    + EmployeeName.Trim() +
    @"</Value>
    </Eq>
    </And>
    </Where>"
                                query.ViewFields =
    " <FieldRef Name='ID' />";
    Ahsan Ranjha

    Hello,
    Download CAML query builder from below location and use it to build your query:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/f7b36ebc-6142-404a-8b04-9c87de272871/where-can-i-download-the-u2u-caml-query-builder-for-sharepoint-2010may-i-know-the-exact-link?forum=sharepointgeneralprevious
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Query to  get  a date column is greater than a year

    Hi all,
    I had a table :
    order date
    1 4/4/2010 9:10:09 AM
    2 5/6/2011 9:10:09 AM
    my select statement should return a row which is more than a year
    and date is timestamp(3) datatype (considering leap year to)
    can any one help me
    Thanks in advance!!!!
    Edited by: 846773 on Apr 11, 2011 1:21 PM

    Justin Cave wrote:
    or
    WHERE order_date < sysdate - interval '1' year Careful:
    SQL> select date '2012-02-29' - interval '1' year
      2  from dual;
    select date '2012-02-29' - interval '1' year
    ERROR at line 1:
    ORA-01839: date not valid for month specified
    SQL> SY.

  • Query to select values greater than, where AS clause is used

    Oracle 10g
    Requesting your help in writing the query correctly.
    I have the following 2 tables. The AddProjectPhase and AddProject tables. It is many to many relationship. Each project can have a predefined set of 4 different phases under it. Each phase has a start date and an end date. I am writing a report to get the phases which have a duration greater than, for example, 3 months.
    The query below is working fine to just display the list of all the phases along with the duration of each phase. I am not able to modify it to select the phases which have a duration, for example, 3 or more months.
    CREATE TABLE  "ADDPROJECT"
       (     "VERSIONNO" NUMBER(*,0),
         "PROJID" VARCHAR2(20),
         "PROJNAME" VARCHAR2(60),
         "PROJSTARTDATE" DATE,
         "PROJSTATUS" VARCHAR2(20),
         "PROJENDDATE" DATE,
         "PROJENDTYPE" VARCHAR2(20),
         "PROJENDREASON" VARCHAR2(1000),
         "UCPROJECTMANAGER" VARCHAR2(20),
         "FROMDATE" DATE,
         "TODATE" DATE,
         "SRCHFIELD" VARCHAR2(20),
         "OPERATOR" VARCHAR2(20),
         "PARENTPROJID" VARCHAR2(20),
         "PROJHIDDENDATE" VARCHAR2(20),
          CONSTRAINT "PK_B36" PRIMARY KEY ("PROJID", "PROJHIDDENDATE") ENABLE
    CREATE TABLE  "ADDPROJECTPHASE"
       (     "VERSIONNO" NUMBER(*,0),
         "PROJPHASEID" NUMBER(9,0),
         "PHASESTARTDATE" DATE,
         "PHASEENDDATE" DATE,
         "RRDATE" DATE,
         "PHASENAME" VARCHAR2(30),
         "PROJPHASESTATUS" VARCHAR2(20),
         "PROJID" VARCHAR2(20),
         "OPERATOR" VARCHAR2(20),
         "FROMDATE" DATE,
         "TODATE" DATE,
         "SRCHFIELD" VARCHAR2(20),
         "REVIEWCOMMENTS" VARCHAR2(1000),
         "PROJHIDDENDATE" VARCHAR2(20),
         "ISUEVALUATION" NUMBER(1,0),
         "SOLUTIONINGTEAMINVOLVEMENT" NUMBER(1,0),
         "ISUNAME" VARCHAR2(20),
          CONSTRAINT "PK_A63" PRIMARY KEY ("PROJPHASEID") ENABLE
       )Below is the query to display the list of all the phases along with the duration of each phase which is working fine.
    SELECT pp.phaseName "phasename",
    pp.phaseStartDate "phaseStartDate",
    pp.phaseEndDate "phaseEndDate",
    pp.projPhaseStatus "projPhaseStatus",
    ap.projID "projID",
    ap.projName "projName",
    ap.projHiddenDate "projHiddenDate",
    ap.projStartDate "projStartDate",
    CASE
        WHEN pp.phaseEndDate IS NOT NULL
        THEN MONTHS_BETWEEN(1+pp.phaseEndDate,pp.phaseStartDate)
        WHEN pp.phaseEndDate IS NULL
        THEN MONTHS_BETWEEN(1+sysDate,pp.phaseStartDate)
        ELSE null
    END "phaseMonths"
    FROM AddProjectPhase pp, AddProject ap
    WHERE ap.projID = pp.projID
    AND ap.projHiddenDate = pp.projHiddenDate
    ORDER BY ap.projIDHowever the modified query shown below to select all the phases greater than, for example, 3 months, is resulting in
    ORA-00904: "PHASEMONTHS": invalid identifier SELECT pp.phaseName, pp.phaseStartDate, pp.phaseEndDate
    FROM AddProjectPhase pp, AddProject ap
    WHERE ap.projID = pp.projID
    AND ap.projHiddenDate = pp.projHiddenDate
    AND PhaseMonths IN
    (SELECT
    (CASE
    WHEN pp.phaseEndDate IS NOT NULL
    THEN MONTHS_BETWEEN(1+pp.phaseEndDate,pp.phaseStartDate)
    WHEN pp.phaseEndDate IS NULL
    THEN MONTHS_BETWEEN(1+sysDate,pp.phaseStartDate)
    ELSE null
    END) AS PhaseMonths
    FROM AddProjectPhase pp, AddProject ap
    WHERE ap.projID = pp.projID
    AND ap.projHiddenDate = pp.projHiddenDate)
    ORDER BY ap.projID

    Looking for this?
    select *
       from (
            SELECT pp.phaseName "phasename"
              , pp.phaseStartDate "phaseStartDate"
              , pp.phaseEndDate "phaseEndDate"
              , pp.projPhaseStatus "projPhaseStatus"
              , ap.projID "projID"
              , ap.projName "projName"
              , ap.projHiddenDate "projHiddenDate"
              , ap.projStartDate "projStartDate"
              , CASE WHEN pp.phaseEndDate IS NOT NULL THEN MONTHS_BETWEEN(1+pp.phaseEndDate,pp.phaseStartDate)
                     WHEN pp.phaseEndDate IS NULL     THEN MONTHS_BETWEEN(1+sysDate,pp.phaseStartDate)
                     ELSE null
                END "phaseMonths"
              FROM AddProjectPhase pp, AddProject ap
             WHERE ap.projID = pp.projID
               AND ap.projHiddenDate = pp.projHiddenDate
             ORDER
                BY ap.projID
      where "phaseMonths" >= 3

  • Trying to do date field greater than a specified date in condition editor

    Hi All,
    I am trying to build the XML predicate in the expression editor to check that the posting date sent is greater than a specified date to determine the reciever. I can get it to validate posting date is = to specified date, but when I change the = to > it fails to properly determine the receiver, when I send a valid document.
    Below is the expression build
    (/p1:ServiceAcknowledgementConfirmation/ServiceAcknowledgement[CreationDateTime>'2007-02-03'] EX )
    has anyone done this type of check. I have it set as a date type for the expression.
    Regards,
    Chris

    Hey all,
    I tried >= 2007-02-04 and sent in that exact date. It failed. I removed > so that it is just = 2007-02-04 and it was successful. So, is >= an allowable operator?
    Thanks,
    Chris

  • In Query mode, date items does not accepts more than 10 characters..Why?

    Dear All,
    In my form, While querying my date items, it does not accepts more than 10 Characters. Could it be changeable.
    Actually i want to search like greater than specified date( >01/01/2007 ).
    But i can specify like >01/01/07. After tabbing out from that item, it displays like >01/01/200.
    How to overcome this issue.
    Please help.
    Regards,
    Balaji

    You are absoletely correct Francois!
    Previously i have made a mistake that both of my maximum length and query length property to 20. That time it was not worked. Now i changed my maximum length to the old one like 11 and i changed only the query length to 20.
    Now it is working. I understood the concept wrongly.
    Thanks Francois!

  • Variables in query, greater than

    Please tell me if the following is possible.
    I have a query with a variable that asks for a date to be entered, e.g. 02.2006 and spits out the results.
    However I have been asked to set this variable in such a way that it should display the results of 02.2006 or whatever I have
    entered and all of the months greater than 02.2006 or whatever. ( not less than only 02.2006 and greater than )
    Is it possible. I do not think so but I thought I verify from the SDN gurus. Please help if you can. Thanks.

    So basically, you want to know the different value of calmonth in row with key figures being in column.
    I thought you want the report strucutre in ROW like:
    User Entered calmonth
    User Entered Calmonth - 12.9999
    But your report requirement is
    User Entered Calmonth
    User Entered Calmonth + 1
    User Entered Calmonth + 2
    12.9999
    If this is the requirement,
    Create a customer exit variable, ready for input with interval.
    Let user enter a date say 05.2006
    Now in the customer exit,
    Set LOW as user entered low value 05.2006
    Set HIGH as '999912'.
    That would restrict your calmonth by user entered - 12.9999 and in the row you will see one row per one calmonth value and once your row is restricted by month, you will see KF restricted by that month automatically.
    - Danny
    Edited by: Danny Matt on Jul 7, 2009 11:02 AM

  • Xpath query using greater than operator

    I'm trying to evaluate some xml to determine if it matches some criterium.
    MyXmlColumns contains the following kind of data "<Values><Value>data1</Value><Value>data2</Value><Values>"
    When I execute the following query I get zero rows returned when it should match some rows containing this data.
    select * from mydata
    where existsNode(MyXmlColumn, '/Values/Value[. > "data1"]') = 1
    The question is why greter than, lesser than, does not work, and if there is any alternative.
    If I use equals operator, or greater than but using a number it works.
    I know that I can use XmlExists function but I'm using Oracle 9i r2 so it's not an option.
    Thanks in advance for any suggestion.

    but I'm using Oracle 9i r2
    The question is why greter than, lesser than, does not workWorks on 9.2.0.8:
    SQL> select * from v$version where rownum = 1
    BANNER                                                         
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    1 row selected.
    SQL> with mydata as
       select xmltype('<Values><Value>data1</Value><Value>data2</Value></Values>') MyXmlColumn from dual
    select * from mydata t where existsNode(t.MyXmlColumn, '/Values/Value') < 3
    MYXMLCOLUMN                                                              
    <Values>                                                                 
      <Value>data1</Value>                                                   
      <Value>data2</Value>                                                   
    </Values>                                                                
    1 row selected.

  • Date Greater Than Operator

    I am comparing two date fields from two tables. Both are in DATE format. The dates look like this: 22-Apr-2006 07:00:10 AM and 01-Jun-2007 12:00:00 AM. I am adding this statement to a WHERE clause:
    and vendors.vend_obsolete_date > document_xref.acceptance_date;
    In this particualr case, I should get no result because the 1st date came before the 2nd date. But when I run my program, it seems to be ignoring my > statement. Is using a greater than sign the proper syntax to compare if the 1st date field is bigger (came after) another?
    Thanks!

    Greater than works on DATE columns, no problem. A simple test confirms it.
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 9 17:50:52 2007
    select 'oops, something is wrong' as result
    from   dual
    where
      to_date( '22-Apr-2006 07:00:10 AM', 'dd-Mon-yyyy hh12:mi:ss AM' )
      > to_date( '01-Jun-2007 12:00:00 AM', 'dd-Mon-yyyy hh12:mi:ss AM' )
    no rows selectedThere must be something else about your query or data that's causing the anomaly.
    Joe Fuda
    SQL Snippets

Maybe you are looking for

  • How do I put strings into an RT FIFO?

    I have a 1 KHz RT loop that occasionally has an event that I want to log to a file.  I can't do a file write directly from my RT loop, so I want to use an RT FIFO to get the log message to another lower rate (and lower priority) loop that sits on the

  • How do I make my iPhone connect to my Mac and sync my apps from my phone to my computer?

    I recently switched my iPhone account to a new  computer, and I can't figure out how to make my computer recognize my apps on my phone. I have a new email that i use for my iTunes stuff and it works, but on my phone it doesn't recognize the new email

  • Can you retrieve a lost link to online form?

    One of the respondents to my online form has lost their email with a link to their saved form. Is their any way for them or I to retrieve the link?

  • Acrobat Extended Audio Options

    Hello! I have Acrobat Extended and have created a Portfolio. Now I need to add Audio to explain the documents I added. However, the option to record Audio is always 'greyed' out. Do I have to go back and turn each of my files into a Powerpoint presen

  • Adding Business Content to Transports

    Somebody at work has installed some BC without including it in a transport. Is there any way of finding out exactly what was installed so that I can retrospectively include it in a transport? I know that the bloke followed a specific building block b