SDO_FILTER and SDO_RELATE combined in the same query

Is it possible to combine these two operations?
I have a query that ideally should use SDO_RELATE for polygon data (some 25 million records). However it takes too long to run.
For curiosity's sake I tried using SDO_FILTER and again this takes hours. Again for curiosity's sake I combined the two and records are returned in about 2 mins. Please see the query below (to simplify matters I have used point data).
SELECT
FROM
table t
WHERE
MDSYS.SDO_RELATE(
t.geometry,
MDSYS.SDO_GEOMETRY( 2001,
null,
MDSYS.SDO_POINT_TYPE( 501900, 308000, null ),
null,
null
'mask=anyinteract querytype=WINDOW'
) = 'TRUE'
AND MDSYS.SDO_FILTER(
t.geometry,
MDSYS.SDO_GEOMETRY( 2001,
null,
MDSYS.SDO_POINT_TYPE( 501900, 308000, null ),
null,
null
'mask=anyinteract querytype=WINDOW'
) = 'TRUE'
As I see it, in this case SDO_FILTER is doing the primary filtering part. SDO_RELATE is doing primary filtering again followed by secondary filtering the resulting data which is why it is quicker. The data does appear to be correct.
Now am I barking up the wrong tree? Whether I am or not, why is this combination faster than individual use? I would appreciate any thoughts on this please.
Cheers guys
James

something else is going on, although without seeing the real query it is hard to know.
SDO_RELATE is a supoerset of SDO_FILTER. With SDO_FILTER and index query is done, with SDO_RELATE an index query is done, then the relate is done on the geometries returned by the filter query.
What kind of index are you using?
What version of spatial are you using?
Can you post the query window?
Are your geometries valid?

Similar Messages

  • Using join and batch reading in the same query

    Hi,
    I wonder if it is possible to use "Joining" and "batch reading" in the same query.
    For example I Have
    A -> 1-1 B
    A -> 1-1 B
    B -> 1-M C
    This is the case where I have two separate 1-1 relationships to the same class B from A. Toplink 10.0.3 can manage it nicely through joining.
    Now, I would like to read a set of As (with its 2 Bs) and all Cs for each B.
    It seems that the following configuration does not work:
    A -> 1-1 B (use joining)
    A -> 1-1 B (use joining)
    B -> 1-M C (Batch read)
    Any help would be greatly appreciated
    Tony.

    James,
    Would you be so kind to look at the following code?
    Am I formulating it correctly to achieve my desired behavior?
    Trip.class -> 1-1 PickupStop
    Trip.class -> 1-1 DropoffStop
    PickupStop and DropoffStop extend Stop and use same table (STOP)
    Stop -> 1-M StopEvents
    I would like to fetch all Trips, with their Stops and all StopEvents in 2 queries:
    1. Trip joined with Stop
    2. Batchread StopEvents
    Code:
    ReadAllQuery raq = new ReadAllQuery(Trip.class);
    Expression qexp1 = new ExpressionBuilder();
    Expression qexp2 = new ExpressionBuilder();
    raq.addJoinedAttribute("pickupStop");
    raq.addJoinedAttribute("dropoffStop");
    raq.addBatchReadAttribute(qexp1.get("pickupStop").get("vStopEvents"));
    raq.addBatchReadAttribute(qexp2.get("dropoffStop").get("vStopEvents"));

  • Is it possible to use an exact phrase and a wildcard in the same query

    I am building an address finder, and i have an option where the user can enter part or a full uk postcode. There is a ctxcat index on the address field. I am having a problem searching for part of the postcode, if i enter 'ZZ1 2*' it finds all ZZ1 and all house number 2's if i enter ' " ZZ1 2"*' it fails with an error, is this a bug or is it not possibl to use the exact phrasing and wildcard at the same time.
    If its not possible can anyone suggest another way round this query.
    Thank

    hi,
    in my table i have a column called address,
    these would contain something along the lines of these 2 records.
    10 high street anytown ZZ1 3ZZ
    3 bridge street anytown ZZ1 8ZZ
    If searching on the postcode, the user may enter ZZ1 3 at the moment this would bring back both records, the first one from the ZZ1 and the second one from the house number 3. however if ZZ1 3 is entered i am wanting to just search on the postcode, so it would only match on the first record. so i would like to put the double quotes round the "ZZ1 3" to match on the exact phrase, but then no records come back because of the two letters after the 3, this was why i am asking about the wildcards after the exact phrase ,atch, so it can match the exact phrase of 'ZZ1 3' but then allow any characters after that.
    hope this explaings my problem a bit better.

  • Two views of the same query

    Hi,
    In the WAD, If I try to attach one view of a query to a chart and another view of the same query to a table, both of the them display the results of the first view. What is the reason?
    Thanks.

    Hi,
    This should not happen, check you might not be assigning correct views to different web elements. Create two data provider by assigning different view and assign them to web element.
    Regards,
    Kams

  • Different LOVs in af:query and af:form for the same VO attribute

    Hi,
    We need to display different LOVs in af:query and af:form for the same attribute in VO.
    Is it possible to use LOV Switcher for this ?
    What condition can we use in LOV Switcher attribute to check if it is View Critearia row or VO row ?

    We have a VO attribute "User" which needs to be displayed as LOV in a Search Panel ( af:query component created using View Critearia ) and in a af:form.
    When this VO attribute is displayed in search panel, in LOV, we need to show all users.
    When this VO attribute "User" is displayed in a form for editing, in LOV, we need to show only active users.
    For this, we created two LOVs "ActiveUsersLOV" ( which shows only active users ) and "AllUsersLOV" ( which shows all users ) on VO attribute "User".
    LOVSwitcher attribute should return "ActiveUsersLOV" if the LOV is displayed in form and "AllUsersLOV" if the LOV is displayed in search panel.

  • How to share the same QUERY among report, chart on the same page? and more

    Dear HTMLDB experts,
    I am absolute rookie to this tool, so I have some questions need you all's help.
    (1)
    When I build a page with a spread sheet and a chart on the same page, they all use the same query to get the data. However, I have to type in the SQL twice in spread sheet(report region) and chart's attribute sections. It seems so dumb, does it really run the same query twice, is there a way to share the same query?
    i.e. SELECT name, timestamp, value FROM foo WHERE name = :P1_NAME? (by the way, is :P1_NAME case sensitive?)
    (2)
    In the same chart, if I have two series from two columns of the same table, I have to write 2 queries, one
    select null, timestamp, value1 from same_table
    and
    select null, timestamp, value2 from same_table
    Is it possible to use one query: select timestamp, value1, value2 from same_table and define the series on two value columns of this single query? It's really no point to run two queris.
    (3)
    In a chart, when the query has ORDER by clause, it seems the chart is not showing up.
    So instead of using the query below
    SELECT null, to_char(ts,'mmdd') ts, value
    FROM same_table
    WHERE ts >= TRUNC(SYSDATE) - :P2_DAYSAGO - 1
    AND name = :P1_NAME
    ORDER BY ts
    I have to use a walkaround query
    SELECT null, ts, used
    FROM
    SELECT null, to_char(ts,'mmdd') ts, value
    FROM same_table
    WHERE ts >= TRUNC(SYSDATE) - :P2_DAYSAGO - 1
    AND name = :P1_NAME
    ORDER BY ts
    Further more, it seems :P1_NAME in the same subquery is not working for the chart, i get xml parsing errors in SVGviewer, however the same query works for the spread sheet area, I am really puzzeled. Not sure whether it's dumb tool or dumb me :-)
    Appreciate your help!
    Jianhui

    <quote>
    Further more, it seems :P1_NAME in the same subquery is not working for the chart, i get xml parsing errors in SVGviewer, however the same query works for the spread sheet area, I am really puzzeled. Not sure whether it's dumb tool or dumb me :-)
    </quote>
    For this particular issue, I found out that neither is the tool dumb nor is me. It's SVGViewer messed up with the firefox browser, after I rebooted the computer this morning, problem is gone. I didnt reboot after I copied SVGViewer dll and zip file to firefox plugin directory yesterday. Never had that pain with IE and Netscape, oh well :-). So please ignore this section, however other questions are still unsolved puzzles for me. Thank you all if you can share some light on those questions.

  • Different results for the same query and same data !  (oracle 9i)

    Hi,
    This is a mystery for me. I've got on my database exactly the same data that my customer (exported schema). We both launch the same query (generated by the software that we sold him). This query has a criteria IN (SELECT MAX()...) to get only data from the last year.
    The query gives 477 rows on my computer (correct answer), but no row on his! We have the same data! The only difference is the Oracle release : 9.2.0.6.0 for him, 9.2.0.1.0 for me.
    If he executes the subquery alone, it gives the expected result.
    If he replaces the MAX() in the subquery by the returned value (year 2016), he gets his 477 rows.
    I've rewritten the query with a NOT EXISTS, and now all is fine. (Less efficient but it works).
    I have no rational explication. Did I miss something ?
    Thanks for any answer.
    This is the query:
    SELECT ...
    FROM
    CRA, GRA, ...
    WHERE
    /* subselect */
    (CRA.COLLCOD, CRA.CRANEXE, CRA.CRANCODBUD, CRA.GRANNUM, CRA.CRANCOD1, CRA.CRANCOD2, CRA.CRANCOD3, CRA.CRANCOD4)
    IN (
    SELECT b.COLLCOD, MAX(cranexe), b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    FROM CRA b
    GROUP BY b.COLLCOD, b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    AND... /* other filters and joins */

    v9.2.0.1 was full of bugs. a lot of these bugs had to do with "incorrect results", typically associated with old stats or complex queries (certain types of subqueries were very likely to give wrong resutls, due to the way they were rewritten by the optimizer).
    apply the 9.2.0.6 patch set

  • How can I combine the nav bar and menu bar on the same line to save space?

    Firefox v29 seems to be a huge step backward in customization. I need to save space for content so previously I turned off tabs and combined the menu bar and nav bar on the same line. The url space is way too long anyway. Now with v29 all my customization is gone and I cannot get it back. I can no longer move items on the nav bar to combine it with the menu bar. Why was this done? It only limits my ability to customize my browser? I am very frustrated that you took a great browser and ruined it.

    I get it that Firefox has changed, but the change is for the worse. It makes it impossible to customize menus as I had before v.29.

  • How to unlock the request for a report and add the same query to new reques

    hi,
         how to unlock the request for a  and add the same query to new reques

    You can unlock in SE03 tcode.
    Goto tcode SE01, give the transport number --> display --> double click on the transport --> in the next screen select all the elements --> delete --> save.
    To attach it to another transport, In RSA1, click on transport connection> Choose Object types> query elements --> here you can find your query/ or you can search, which you can drag to right and attach to the transport (using truck button).

  • Multiple sheets with the same query automaticly

    Hi gurus,
    I want to create a workbook with one query and one input variable.
    The input variable is the 0PLANT. And I want to execute the same query so many times as  0PLANPLANTs has the 0PLANT and each 0PLANPLANT appear in different sheets.
    There are different 0PLANTs with 4,5,6,... 0PLANPLANTs and the workbook has to be valid to all 0PLANT and automaticly generate 4,5,6,... sheets depending of the number of 0PLANPLANTs has the 0PLANT.
    Any idea?
    Best regards

    But, what macros? I don´t have idea over macros excel´s.
    Thanks for your answer.

  • Different view of the same query between users

    Hi at all,
    I strongly hope you can help me.
    The problem that i have is that:
    I have a different view of a query inserted in a workbook respect the view of the same query that have other users.
    In particular I watch in my query 4 fixed characteristic of the query ( Cost center, order type , controlling area, fiscal variant ), below the free characteristic block  and before data table.
    Instead other user watch only 3 fixed characteristics ( Cost center, order type , controlling area ).
    This is a problem because in the workbook there is a macro that reads the data from a fixed raw. So that this macro doesn't' t work in my workbook.
    I would specify that the workbooks is called from rules and not from fevorites.
    Thank you very much for your attention!
    Bye
    Fabio

    Hi Erwan,
    i have the SAPGUI version 3500.8.044 and the item you describes :
    Bex menu ( Business explorer -> Change Query -> Change variable values )
    let me to change the values of input variables.
    The new layout query, after the input of the new values, has the same rows of the fixed query value ( fyscal variant too).
    Thank you for your answer..
    bye
    Fabio

  • How to use a calculated column in the same query

    Hi All,
    I need some help with using a calculated column in the same query.
    For eq
    I am joining a couple of tables and some of the select columns are calculated based on the columns of the tables and i want a new column in the same query to use this calculated feild in some other calcualtion.
    something like this...
    select (12+3) as Sum1, (12-3) as Sum2, (Sum1 + Sum2 ) as Sum3
    from dual
    or
    select (12+3) as "Sum1", (12-3) as "Sum2", CASE WHEN ( "Sum1" / "Sum2" * 100 > 0 ) THEN 'Yes' ELSE 'No' END
    from dual
    Thanks

    user548171 wrote:
    select (12+3) as Sum1, (12-3) as Sum2, (Sum1 + Sum2 ) as Sum3
    from dual
    or
    select (12+3) as "Sum1", (12-3) as "Sum2", CASE WHEN ( "Sum1" / "Sum2" * 100 > 0 ) THEN 'Yes' ELSE 'No' END
    from dual
    ThanksWhat about just repeating the column values:
    select (12+3) as "Sum1", (12-3) as "Sum2", CASE WHEN ( (12+3) / (12-3)  * 100  > 0 )  THEN 'Yes' ELSE 'No'  END FROM DUAL

  • Putting waveform graphs and 8bit images in the same window by Windraw

    How to put waveform graphs and 8bit images in the same window by Windraw VI?

    Use "Invoke Method: Get Image" to get a pic of your waveform graph/chart. Then combine this pic with your 8bit image using the IMAQ tools (IMAQ ImagetoImage). If you need an example send an e-mail again ...
    Michael

  • XSU  and CURSOR expression in the sql query

    Platform: oracle 8.X on ibm aix and java client code from
    windows NT.
    JDBC DRIVER: JDBC Oracle thin driver version 1.2.
    when i execute a Sql satement with Cursor expression from the
    java client code with XSU it returns an XML DOM But if the
    CURSOR EXPRESSION IN THE SQL QUERY RETURNS EMPTY ROWS i get
    back an error node with "ORA-01001 Invalid Cursor" error
    message.i had aslo set the setNullAttributes(true) property
    on oraclexmlquery.
    Interestingly, if i exceute the same query in the SQL plus
    it returns the column names with no rows.
    is there any way where i can get xml document with table
    structure, when there are no rows instead of ORA error message.

    Ok.
    I assume that you have for one activity several asset PNR and for one asset several activity.
    The factPNR is on this way a real bridge table. It's a way to be able to design a many-to-many relationship.
    Have a look here for more detail on how to build a many-to-many relationship :
    http://gerardnico.com/wiki/dw/data_quality/relationships#many-to-many
    Therefore I assume that you want this design :
    DimActivity -< FactActivity >- < FactPNR >- DimPNR  and you will have :
    DimActivity -< FactActivity >- < BridgeTable >- DimPNR  How to build your bridge table ?
    In the physical layer, :
    * create a new table BridgeActivityPNR, open it and select "statement"
    * enter your sql statement
    SELECT DISTINCT A.ROW_WID ACTIVIDAD_WID, B.ROW_WID ASSET_WID
    FROM W_ACTIVITY_F A,
    W_ASSET_D B,
    W_SRVREQ_D C,
    X_S_CMPT_MTRC_F D,
    X_S_ASSET_FEA_D E
    WHERE A.X_SRA_SR_ID=C.INTEGRATION_ID AND
    C.X_VLG_FLIGHT_ID=D.X_ROW_ID AND
    D.X_ROW_ID=E.X_CM_ID AND
    E.X_ASSET_ID=B.X_ROW_ID* add two columns in the column tab : ACTIVIDAD_WID and ASSET_WID
    * create the physical join with the table FactActivity and DimPNR
    * drag and drop in the business model your table BridgeActivityPNR
    * in the BMM, create the complex join like this :
    DimActivity -< FactActivity >- < BridgeTable >- DimPNR  * open your logical bridge table and check the bridge table option.
    And you are done if I didn't forget anything.
    A complete example here :
    http://gerardnico.com/wiki/dat/obiee/obiee_bridge_table

  • Running the same query against numerous databases

    My organization has 20+ clients. Each client has a separate database in the same MSSQL server*. For these purposes, the databases are structurally identical. I've been tasked to gather information from tables in all of these databases. I can use the same query on multiple clients - my issue is switching between databases.
    The naive solution would be for me to declare 20+ DataSource instances, and have some mapping from client name to DataSource. I think that's going to be a real mess and my inclination is to avoid it.
    Another possibility would be dynamically generating the PreparedStatement based on the client, something like
    "SELECT foo, bar " + "FROM " + client.getDatabaseName() + ".dbo.my_table";
    My understanding, though, is that it's a bad practice to have dynamically generated prepared statement calls and not possible to parameterize the 'from' clause.
    Another thing I've been digging around at is using a transaction and an SQL Server call to alter what database calls from that transaction go to. I thought that could be done, but I'm not finding anything which suggests it's possible.
    I guess I've identified my problem, but I'm thrashing on how to solve it. I'm still newish to non-trivial database interactions, so I'd appreciate any input. If I posted this in the wrong place, please feel free to yell at me and move it.
    Thanks in advance,
    Eric
    * Not my fault. I'm new.

    I'm collection usage and storage metrics. "Client X has 200 records, Client Y has 250. Client X has 15 active users, Client Y has 12."
    The data is being read from the client databases and stored into a separate metrics database.
    I anticipate it will be mostly select count() calls.
    I can. For the maintenance reasons I mentioned above, I'd rather not have to maintain all those datasources if I don't have to.
    No, the invocations will be sequential.
    for (each metric type) {
        for (each client) {
            gather information;
            add to batch
        update batch in metrics database
    }I guess I was hoping there was a Sekrit SQL way to swap what database inside a server instance the connection was pointing to. I'm guessing that's not going to happen, and I'm left with N datasources for N clients or generated preparedStatements which swap out the database name in the FROM portion.
    The data is being written to a table in a single, separate metrics database.
    I'm trying not to, honest.
    Edited by: 919852 on Mar 12, 2012 8:38 AM

Maybe you are looking for

  • How do I add a song to my favorites Playlist without removing that playlist from iCloud

    I just purchased a song on my computer and tried to copy the song into my "favorite songs" playlist but I get a warning that adding the song to the playlist will remove the playlist from iCloud and will only be available on the computer.  I don't und

  • Tables for posting period check

    Hi, Can somebody tell me the tables for posting period check for tcodes F-63 and MIR7. I need to check whether the posting period is open when uploading data to these tcodes. Arun Mohan

  • Webdynpro Development: On change of input field Event

    hi, Is there any event in Web Dynpro(Java), that chaught the event of change in an input field? ie, if I change the value of a perticular field, it will caught that event and populate another field accordingly. Thanks, Angshuman

  • How to register non-wsdl based URL in OEG

    How do we register a non-wsdl based URL endpoint in OEG? We had no problem registering a simple WSDL based endpoint on an OEG server. However we cannot find documentation on how to secure/register a RESTful or JSON – URL based service (SOAP, XML over

  • Need new pro key to update from 7.0.4 to 7.1.6?

    Greetings, Have QT Pro v7.0.4 installed. Would like to update to v7.1.6 without having to buy a new key for QTPro. Intuition says I should be able to do this, but conflicting info from Apple makes me question my intuition and hesitate to install v7.1