query takes too long

Hello

The following query takes too long (more than 30 minutes), work with 11g.
The table has three columns RID, ida, geometry and index has been created on all of the columns.
The table has about 5,40,000 documents of point geometries.

Please help me with your suggestions. I want to select the geometry in double point where ida = STRING.


SQL > select a.rid, b.rid from totalrecords, totalrecords b where a.ida = 'CORD' and b.idat = 'CORD' and
sdo_equal (a.geometry, b.geometry) = 'TRUE' and a.rid! = b.rid order of 1,2;

concerning

Hello

Just glad it helped, don't forget to award points ;-).

The SDO_JOIN will use the spatial index for a spatial comparison.
First of all, it will use the index to check which geometries MBR interact, it is the primary filter: http://docs.oracle.com/cd/B28359_01/appdev.111/b28400/sdo_intro.htm#g1000087

Secondly, you should apply a space MASK, pair of geometries that comes out of the primary filter is then compared according to the MASK, MASK for example = EQUAL, will check these pair of geoms are equal.

Now, because you have points, the members are the points themselves, so that if their MBR interact, points to interact, which means they are equal.
This means that the result of the SDO_JOIN points, in this case even a self-join, will give you all the points that are equal.

But as points are also equal in their car, the join join reflexive sdo, will give you: a = b & one = one but also a b.
To this effect, you set the a.rowid< b.rowid,="" to="" avoid="" a="a" but="" also="" b="">

I hope this explains it a little, again read and read great literature (early!), will have a better understanding.

Good luck

Luke

Tags: Database

Similar Questions

  • Data dictionary query takes too long.

    Hello
    I'm using ORACLE DATABASE 11 g.

    The following query takes too long to run and not give the result. As I've tried a few tricks SQL Oracle but it forces developed.
    SELECT 
    distinct B.TABLE_NAME, 'Y' 
      FROM USER_IND_PARTITIONS A, USER_INDEXES B, USER_IND_SUBPARTITIONS C
     WHERE A.INDEX_NAME = B.INDEX_NAME
       AND A.PARTITION_NAME = C.PARTITION_NAME
       AND C.STATUS = 'UNUSABLE'
        OR A.STATUS = 'UNUSABLE'
        OR B.STATUS = 'INVALID';
    Please guide me what to do? to run this query in a fast paced mode...


    Thanks in advance...

    Your query is incorrect. It returns all tables if A.STATUS = "UNUSABLE" or B.STATUS = "INVALID". Most likely, you meant:

    SELECT
    distinct B.TABLE_NAME, 'Y'
      FROM USER_IND_PARTITIONS A, USER_INDEXES B, USER_IND_SUBPARTITIONS C
     WHERE A.INDEX_NAME = B.INDEX_NAME
       AND A.PARTITION_NAME = C.PARTITION_NAME
       AND (C.STATUS = 'UNUSABLE'
        OR A.STATUS = 'UNUSABLE'
        OR B.STATUS = 'INVALID');
    

    But the above will return sous-partitionnee tables not valid/no usable index. He ain't no non-sous-partitioned tables partitioned index/index not valid/not usable with same partitions in the form of tables not partitioned with valid/no unusable indexes. If you want to get any table with indexes not valid/not usable, you outer join that's going to hurt even more performance. I suggest you use the UNION:

    SELECT  DISTINCT TABLE_NAME,
                     'Y'
      FROM  (
              SELECT INDEX_NAME,'Y' FROM USER_INDEXES WHERE STATUS = 'INVALID'
             UNION ALL
              SELECT INDEX_NAME,'Y' FROM USER_IND_PARTITIONS WHERE STATUS = 'UNUSABLE'
             UNION ALL
              SELECT INDEX_NAME,'Y' FROM USER_IND_SUBPARTITIONS WHERE STATUS = 'UNUSABLE'
            ) A,
            USER_INDEXES B
      WHERE A.INDEX_NAME = B.INDEX_NAME
    /
    

    SY.

  • What query takes too long

    How can you know which application takes too long to run in a database? and most of the resources consumption?

    user3636719 wrote:
    How can you know which application takes too long to run in a database? and most of the resources consumption?

    Try to use the following text:

    SELECT * FROM
    (SELECT
    sql_fulltext,
    sql_id,
    child_number,
    disk_reads,
    executions,
    first_load_time,
    last_load_time
    V $ sql
    ORDER BY DESC elapsed_time)
    WHERE ROWNUM<>
    ;

    Also, try the v$ session_longops querying:

    Select * from)
    Select the target, sofar, less, totalwork.
    units, elapsed_seconds, message
    from v$ session_longops by start_time desc)
    where rownum<>

    Kind regards
    Rizwan Wangde
    SR Oracle DBA.
    http://Rizwan-DBA.blogspot.com

  • How to stop the query takes too long

    Is there a way to tell oracle to stop a query that takes too long to run?

    I'm trying to end a way to prevent some users from running any querys that takes more than 2 minutes... any help?

    I use 10g

    Thank you!

    Hello

    You can create a profile... and limit...

    CREATE a PROFILE prof_low LIMIT
    CPU_PER_CALL 3000 (about 30 seconds)
    PRIVATE_SGA 500K
    LOGICAL_READS_PER_CALL 1000;

    ALTER USER myuser PROFILE prof_low;

    Concerning
    Joao Oliveira

  • SQL query takes too long to run (1 h 25 min)... pls help how to set up the query.

    Hello

    Could someone please help how to tune the query as its takes a long time to retrieve the results.

    Select

    col1,

    col2,

    col3,

    COL4,

    col5,

    col6,

    col7,

    COL8,

    col9,

    col10,

    Col11,

    col12,

    Sum (volume1),

    Sum (volume2),

    Sum (volume3),

    Sum (volume4),

    Sum (volume5),

    Sum (volume6),

    Sum (volume7),

    Sum (volume8),

    Sum (volume9),

    Sum (volume10),

    Sum (volume11),

    Sum (volume12),

    Sum (volume13),

    Sum (volume14),

    Sum (volume15),

    Sum (volume16),

    Sum (volume17),

    Sum (Volume18),

    Sum (volume19),

    Sum (volume20),

    Sum (rate1),

    Sum (rate2),

    Sum (rate3),

    Sum (rate4),

    Sum (rate5),

    Sum (rate6),

    Sum (rate7),

    Sum (rate8),

    Sum (rate9),

    Sum (rate10),

    Sum (rate11),

    Sum (rate12),

    Sum (rate13),

    Sum (rate14),

    Sum (rate15),

    Sum (rate16),

    Sum (rate17),

    Sum (rate18)

    Sum (rate19),

    Sum (rate20)

    Of

    Table 1 - 13, 25, 99, 400 records

    Table2 - 13, 45, 1000 records

    Table 3 - 4, 50, 000 records

    Table 4 - 1,00,000 records

    table5 - 30 000 records

    where tabl1.col1 = table2.col2,

    Table1.Col1 = table3.col1.

    table2.col2 = table3.col2...

    Group

    Sum (volume1),

    Sum (volume2),

    Sum (volume3),

    Sum (volume4),

    Sum (volume5),

    Sum (volume6),

    Sum (volume7),

    Sum (volume8),

    Sum (volume9),

    Sum (volume10),

    Sum (volume11),

    Sum (volume12),

    Sum (volume13),

    Sum (volume14),

    Sum (volume15),

    Sum (volume16),

    Sum (volume17),

    Sum (Volume18),

    Sum (volume19),

    Sum (volume20),

    Sum (rate1),

    Sum (rate2),

    Sum (rate3),

    Sum (rate4),

    Sum (rate5),

    Sum (rate6),

    Sum (rate7),

    Sum (rate8),

    Sum (rate9),

    Sum (rate10),

    Sum (rate11),

    Sum (rate12),

    Sum (rate13),

    Sum (rate14),

    Sum (rate15),

    Sum (rate16),

    Sum (rate17),

    Sum (rate18)

    Sum (rate19),

    Sum (rate20)

    Thank you

    Prasad.

    > Could someone please help how to tune the query as its takes a long time to retrieve the results.

    The query you posted is obviously fake.

    If you ask to give us a request that you do not post and we cannot see.

    For real?

  • Query takes too long, but the cost is low

    Hi guys,.

    I run a query on two databases that were created in the same way and have the same data.

    On one, the cost is almost 1 million, and it runs in the space of a few seconds
    On the other hand, the cost is 40,000, and it does not end execution

    I looked at the plan to explain it and there is no Cartesian merge on the second query join, but it takes so long. What can I do to study this?

    Thank you

    The sqlxtplan provides comprehensive information on the query that was executed, or running, depending on the mode you choose. It has all the information of dbms_xplan plus much more. for example all the table definitions used in the query, filters of predicate query, plans for execution, his stats of all tables, indexes, etc... used in the query.
    I find the way the fastest to get an overview of how the optimizer made its decision. If it is running run mode, it, rather than using the id of sql or hash, it also gives a 10053 trace.

  • Query takes too long to run after clone

    Hi all

    We have a query that works well in our development environment and take about 15 seconds to run the query. When we run the same query with the same parameters in a recently cloned instance, the query takes 1200 dry run.
    Please help us on this issue.

    Thank you
    Rambaud

    Thanks for any response.
    We have solved the problem by using indicators of index.

    Thanks for the update!

  • create table query takes too long...

    Hello experts...

    I take the backup of table A, which consist of 135 million records...

    Why use query below...

    create the table tableA_bkup in select * from tableA;

    It takes more time... always running...

    is there another way to quickly query...

    Thanks in advance...

    ECT is one of the fastest ways to do such a thing.

    Do you remember the duplicate data. This means that if your table contains 50 GB of data, then it will have to copy these 50 GB of data.

    Another way may be to use EXPDP to create a backup of the data of the table dump file. However I don't know if there is a difference in performance.
    The two versions might benefit from parallel execution.

  • Statement Update takes too long to run

    Hi all

    I am trying to run this update statement. But its takes too long to run.
        UPDATE ops_forecast_extract b SET position_id = (SELECT a.row_id
            FROM s_postn a
            WHERE UPPER(a.desc_text) = UPPER(TRIM(B.POSITION_NAME)))
            WHERE position_level = 7
            AND b.am_id IS NULL;
            SELECT COUNT(*) FROM S_POSTN; 
            214665
            SELECT COUNT(*) FROM ops_forecast_extract;
            49366
    SELECT count(*)
            FROM s_postn a, ops_forecast_extract b
            WHERE UPPER(a.desc_text) = UPPER(TRIM(B.POSITION_NAME));
     575
    What could be the reason for the update statement to run so long?
    Thank you

    polasa wrote:
    Hi all

    I am trying to run this update statement. But its takes too long to run.

    What could be the reason for the update statement to run so long?

    You did not say what means "too long", but a simple and good reason might be that the scalar subquery on "s_postn" using a full table for each run scan. Potentially this subquery is executed for each row of the table "ops_forecast_extract" that satisfies your filter predicates. 'Potentially' due to "filter/subquery optimization" cunning of the Oracle execution engine that tries to cache results of already executed of instances of subquery. Given that the in-memory hash table that contains these cached results is limited in size, the optimization algorithm depends on the sort order of data and could suffer collisions of hash that it is unpredictable, how this optimization works in your particular case.

    You can view the execution plan, it should at least tell you how Oracle will run the scalar subquery (that tell you nothing about this "filter/subquery optimization" feature).

    Follow the generic guidelines how to generate a useful plan explain output and how to post here:

    Could please post a correctly formatted explain you plan output using DBMS_XPLAN. SCREEN, including the 'Predicate information' section below the plan to provide more details about your statement. Please use the noformat} [{noformat} code {noformat}] {noformat} before tag and {noformat} [{noformat} / code {noformat}] {noformat} tag or after the noformat} {{noformat} code {noformat}} {noformat} tag before and after to improve the readability of the outing:

    In SQL * more:

    SET LINESIZE 130
    
    EXPLAIN PLAN FOR ;
    
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    

    Note that the DBMS_XPLAN package. DISPLAY is only available from 9i on.

    In 9i and above, if "Predicate information" section is missing from the DBMS_XPLAN. Output display, but you get the message "Plan table is old version" instead, you must recreate your plan table using the script server '$ORACLE_HOME/rdbms/admin/utlxplan.sql '.

    In previous versions, you can run the following in SQL * Plus (on the server) instead:

    @?/rdbms/admin/utlxpls
    

    A different approach in SQL * more:

    SET AUTOTRACE ON EXPLAIN
    
    ;
    

    also displays the execution plan.

    In order to get a better understanding where your statement passes the time, you might want to turn on SQL tracing as described here:

    When your query takes too long...

    and after the "tkprof' out here, too.

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • Windows update takes too long to find the updates

    I had just installed a new hard drive on my laptop Dell inspiron N5050. I did a reinstall of system clean of my operating system to windows 7. After that, I started to run windows update to get all the necessary updates that I need to update completely from the computer. He has worked for a very long time with no result. In addition, at least 2 hours. all the settings for windows update is set to the settings recommended. but for some reason, in my view, takes too long to get updates. can someone help me please this possible issue

    Hello Darrin,

    Thanks for posting your query on the Microsoft Community.

    According to the description, the Windows updates take a long time to find the updates.

    I suggest to follow the methods below and check if that helps.

    Method 1: If your computer is experiencing problems find and install updates of the operating system, try using the troubleshooter.to of update of Windows the problem fix. He makes sure your computer is connected to the Internet and checks to see if your network card and Windows Update services are running properly.

    Reference:

    Open the Windows Update troubleshooting tool

    If the problem persists, try Method 2,

    Method 2: run the clean boot: Place your system in the clean boot state helps determine if third-party applications or startup items are causing the problem. Check this question in the clean boot state.

    Reference: How to perform a clean boot in Windows

    http://support.Microsoft.com/kb/929135

     

    Note: After the boot minimum troubleshooting step, read the sections "How to reset the computer to start as usual after a clean boot troubleshooting" in the link provided to return the computer to a Normal startup mode.

    See also:

    Problems with installing updates

    Hope this information is useful. Let us know if you need more help, we will be happy to help you.

  • Windows 7 take too long to the mouse and keyboard anable.

    Hello

    I have replace my SSD HARD drive (2 hard drives 120 GB each RAID 0) w / Windows 7 Pro 64 bit. After the replacement windows take longer time to activate the mouse and the keyboard - 5/10 seconds.
    I've updated the drivers for the two, but still have the same question. The boot is faster, but the mouse and keyboard take longer to wake up.

    Any help?

    Thank you

    M. Vilela

    Hi MVilela,

    Thanks for asking this question to Microsoft Community!

    I understand that after the replacement of the hard disk of the computer takes too long to turn on the mouse and the keyboard.

    Your Windows 7 is better suited in the TechNet forums. I suggest you to send your query there.

    Here is the link: http://social.technet.microsoft.com/Forums/en-us/w7itproperf/threads

    It will be useful. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you.

    Kind regards!

  • "Unable to configure windows update, changes the way back" takes too long...

    My PC just newly formatted and now I can see a problem when I turn it off, he just starts to day and after that it fails... I'm worried about what it takes too long... from 10:00 until 16:00? I read an article on them, she'll just take up to 20-30 minutes, but watch?

    Is there something I can do? Can normally on my return from PC? or what I need to reformat?

    Hi Andrei,

    Thanks for posting your query in Microsoft Community.

    I understand your concern, and we as a community will try to help you in the best possible way we can.

    Here are solutions to some common problems with installing updates. You might be able to fix some problems automatically by running the Windows Update Troubleshooter.

    I suggest you check out the link below and check if it helps.

    "Configuration of the Windows updates failed. Restoration of the changes. Do not turn off your computer"error when you try to install Windows updates

    https://support.Microsoft.com/en-us/KB/949358

    Hope the information helps, if you have any additional questions, feel free to post. We are here to help you.

    Kind regards

    Guru Kiran

  • My daughter Air2 IPad takes too long to save. It is connected to wifi, connected and the screen is locked.mAny advice?

    My daughter Air2 IPad takes too long to save. It is plugged in, connected to wifi and the screen is locked. Any tips?

    How long is too long? If it lasts for more than a few hours - and even that is too long in my humble OPINION - then something is wrong. Completely backup, because it will not terminate in any case if its been so long, forced to reboot the device and try again.

    To force the reboot your device, press and hold the two buttons of sleep/wake and home for at least ten seconds, until you see the Apple logo.

    This may not work either. The backup may be damaged and you will need to remove and start over. However, its easy starting point and it will not hurt anything. If the backup will not end, he has nothing to lose.

  • Should I keep plugging my iphone to the computer during the update download process? especially the download will take too long because it is more than 2 GB and my internet speed is not fast, I can unplug my iphone until the full download?

    I am a new user of Iphone, I must he keep plugging my Iphone to the computer during the update download process? especially the download will take too long because it is more than 2 GB and my internet speed is not fast, I can unplug my Iphone until the full download?

    Without doubt, but why not just make the day downloading overnight?

  • Why it takes too long to open attachments of the e-mail account?

    It takes forever to download attachments from my mail account. I tried to do the following tasks explained on the vista forum: http://windowshelp.microsoft.com/Windows/en-US/help/6b046ae9-1434-4423-9303-400ff6fe686b1033.mspx#ESD, but none of the fixed work possible.

    After clicking on open on the box pop up asking if I want to open or save the attachment, it takes too long to download. The transfer window remains open to showing that he is ready to download, but rest in this window of bhox. I press cancel and try to open once again, if the chance that it opens this file, otherwise it takes forever forceing me to cancel. Very small files most of the time, usually between 50 KB should take seconds.

    I even tried to save the files, but once again the same process. The transfer case remains open but does not download.

    One of the ideas.

    Thanks in advance.

    Hello

    It is not easy to tell exactly what is happening, but it must be something with the e-mail account provider and their page. For me, this case is not a typical problem of Vista, but you can try to find the solution on Vista from Microsoft IT Pro forum.

    By the way: you have an alternative email by another provider address? Is it the same situation?

Maybe you are looking for