Which query is faster to run

I want to use Oracle locator to find customers in a specified area. Which of the ideas on this page is a faster query? The idea where you add the SDO_Geometry column with long and lat to each address record or the index based function idea where no column needs to be added but a table with long and lats is used? thanks.

user8602786 wrote:
I want to use Oracle locator to find customers in a specified area. Which of the ideas on this page is a faster query? The idea where you add the SDO_Geometry column with long and lat to each address record or the index based function idea where no column needs to be added but a table with long and lats is used? thanks.Why don't you try them both out and let us know?

Similar Messages

  • Which query is the job running ?

    Dear all,
    Normally when you want to see the currently running query by a session, you can just query the V$Session table and get the SQL_ID of a particular session. Then use SQL_ID to query V$SQL.
    However when a PL/SQL procedure is submitted via a job. You can see in the V$Session that the job runs as a dedicated server session and the SQL_ID is always null. Although I do see always that the session waits for "DB sequential file read". So it means that some query might be getting executed.
    How can I see which query is being run by the job (dedicated server session)?
    Version : 10.1.0.5
    Thanks in advance

    You can try :-
    SELECT sql_id,sql_text FROM v$open_cursor WHERE sid = :1
    http://www.ContractOracle.com

  • Which query is faster?

    Hi everyone!
    I have two query get the same number of records in a table below:
    Query 1:
    SELECT
    FROM
    SELECT
    SUM(
    CASE
    WHEN TYPE = '1' THEN Amount
    WHEN TYPE = '2' THEN Amount
    ELSE 0
    END
    ) Result
    FROM
    C_BPARTNER
    WHERE Result > 0
    Query 2:
    SELECT
    SUM(Amount)
    FROM
    SELECT
    Amount
    FROM
    C_BPARTNER
    WHERE
    TYPE = '1'
    UNION ALL
    SELECT
    Amount
    FROM
    C_BPARTNER
    WHERE
    TYPE = '2'
    I have data in table C_BPARTNER like below:
    TYPE Amount
    1 100
    2 200
    3 300
    4 400
    Can you tell me know which is faster?
    Thanks a lot!
    Edited by: user12282721 on Nov 24, 2010 7:25 AM
    Edited by: user12282721 on Nov 24, 2010 7:27 AM
    Edited by: user12282721 on Nov 24, 2010 7:32 AM

    user12282721 wrote:
    Can you tell me know which is faster?
    Sure, you just need to supply your table creation scripts and your data in the form of insert statements and the information requested in these threads -
    HOW TO: Post a SQL statement tuning request
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long
    When your query takes too long ...
    Alternately you could just run them yourself.

  • Which query is running in package

    Hi,
    I created one package and run this package in toad
    like
    select reports_package.func_reports('ABC') from dual;
    I have 10 delete and 10 insert statement on this .
    How I will check which query is running iin database.

    799301 wrote:
    I have 10 delete and 10 insert statement on this .
    How I will check which query is running iin database.V$SESSION_LONGOPS holds information on SQL taking > 6 seconds to run but its not always possible to find expected entries in the V$ views
    If you're trying to figure out what is slow a better bet would be to perform trace or use DBMS_PROFILER to analyze the PL/SQL

  • How do I find out which query are running??

    My client is connecting to the database and running application through the web. From the Unix system, I know his job took 99% of CPU time and running for 1 hour already. Is there anyway I can find out which query are running in the Oracle?? So I can tune this query?? thanks..

    Hi,
    You can use the following query to identify it.
    set linesize 100
    set pagesize 100
    SELECT substr(sql_text,1,40) sql,executions, rows_processed,
    rows_processed/executions "Rows/Exec",
    hash_value,address
    FROM V$SQLAREA WHERE executions > 100 AND rownum <= 10
    ORDER BY executions DESC;
    Rgds,
    Dhana

  • Which query will work fast

    Hi,
    Can anybody please suggest which query will work fast
    distinct role_cd is 1,2,3,4 and null in product table
    select * from product
    where nvl(role_cd,'4') not in '4'
    select * from product
    where role_cd in('1','2','3')
    I have 13 millions record in this table and there is no index on role_cd

    I tried this (11gR2) and get below, but still not sure if it is safe to say that the second one is better:
    create table product (role_cd char(2), id number);
    begin
    dbms_stats.set_table_stats( user, 'PRODUCT', numrows => 13000000 );
    end;
    explain plan for 
    select * from product where nvl(role_cd,'4') not in '4';
    Plan hash value: 427209646
    | Id  | Operation         | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |         |   650K|    10M|   319  (91)| 00:00:04 |
    |*  1 |  TABLE ACCESS FULL| PRODUCT |   650K|    10M|   319  (91)| 00:00:04 |
    Predicate Information (identified by operation id):
       1 - filter(NVL("ROLE_CD",'4')<>'4')
    explain plan for 
    select * from product where role_cd in('1','2','3');
    Plan hash value: 427209646
    | Id  | Operation         | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |         |   130K|  2158K|   287  (90)| 00:00:04 |
    |*  1 |  TABLE ACCESS FULL| PRODUCT |   130K|  2158K|   287  (90)| 00:00:04 |
    Predicate Information (identified by operation id):
       1 - filter("ROLE_CD"='1' OR "ROLE_CD"='2' OR "ROLE_CD"='3')

  • ADF: How to find out which query has taken what time?

    Hi,
    I have an ADF application which has many SQL queried running on each button click/page load, so how to find out which query is taking what amount of time? So that i can identify the long running queries and modify them to improve the application performance.
    Thanks in advance.

    Hi,
    As suggested by Timo,you need to start tracing on oracle.jbo package for getting the SQL queries.But I think the second option suggested by him would be better.You will have to override executeQueryForCollection method in VO Impl class .Pseudo code would be
    @Override
    Take start time
    super.executeQueryForCollection
    Take end time

  • How to check which query is consuming most resources....

    Hi guys how can i check which query is consuming most resources , run by which user and how to kill that....
    Khurana

    1)     At the first stage, login to the server and at the OS level I run commands like TOP and see the overall performance of the Server. From this one can know the Total CPU Memory, CPU Usage, Memory Available, and Swap Memory Available and how busy the CPU is.
    2)     Once you identify the top processes in the CPU, relate them to ORACLE using V$PROCESS.SPID = OS Process ID to get the V$PROCESS.ADDR and join this with the V$SESSION.PADDR to get the V$SESSION.SID and SERIAL# columns.
    3)     Then enable the Session Trace using DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION.
    4)     look on the Trace File using the TKPROF. During this sort the Trace File using various options like EXEELA/DSK, PRSELA/DSK, FCHELA /DSK.
    5)     Once you identify the expensive SQL statements, inform the user about it and KILL the respective job.

  • Updated to LR 5.4, images now importing extremely slow. After importing and rendering images are still very slow to go through and develop. No issues in LR 5.3 which was very fast.

    After importing and rendering images are still very slow to go through and develop. No issues in LR 5.3 which was very fast. Canon,Nikon, Leica and Fuji files all rendering slow. iMac 2.9 ghz 16gb RAM OSX 10.8.5. Catalogs and images are kept on external drives. Drives running fine. Really need a fix on this since I'm norally imported and processing at least 4,000 images per LR Catalog. Is there way to revert back to 5.3? I can't use 5.4 is its current state. Thanks.

    Download LR 5.3 and install it
    By the way, lots of people have this complaint about LR 5.4, and the advice I give is to use LR 5.3 unless you need one of the new camera models supported by LR 5.4

  • Which query is best

    Hi,
    Which query is best interms of performance.
    SELECT NAME
    COUNT(ID) AS CNT,
         RANK() OVER (ORDER BY COUNT(ID) DESC) AS RANK
    FROM TABLE_1
    GROUP BY NAME
    SELECT NAME
    --- COUNT(ID) AS CNT,
         RANK() OVER (ORDER BY COUNT(ID) DESC) AS RANK
    FROM TABLE_1
    GROUP BY NAME

    Which query is best interms of performance. They dont look similar, i.e., in the second query, you have commented out --COUNT.  This will avoid sorting, by the way.
    Do you think both queries gives you the same output?
    you have said in your last reply that you hate full table scans.
    Let me tell you, FTS are always not evils and INDEX scan is not always FASTER.
    it all depends on many factors why optimizer chooses FTS over INDEX scan.
    Jaffar

  • How to get query execution time without running...?

    Hi ,
    I had one requirement .... as follows ......
    i had 3 sql statements . I need to execute only one sql which execution time is very less.
    Can any one help me , how to get query execution time without running that query and without using explain plan..?
    Thanks,
    Rajesh

    Kim Berg Hansen wrote:
    But you have ruled out explain plan for some reason, so I cannot help you.OP might get some answers if query was executed before - but since restart. Check V$SQL dynamic performance view for SQL_TEXT = your query. Then ROUND(ELAPSED_TIME / EXECUTIONS / 1000000) will give you average elapsed time.
    SY.
    Edited by: Solomon Yakobson on Apr 3, 2012 8:44 AM

  • How to find which query ORA-1652: unable to extend temp segment by 128 in

    How can i find which query caused the below error,the query is not running currently
    ORACLE ERRORS IN ALERTS LOG dnb2stg3 - lnx300 on Thu Jun 17 12:10:01 EDT 2010
    1 ORA-1652: unable to extend temp segment by 128 in tablespace TEMP_SCHED
    SQL> select inst_id, tablespace_name, total_blocks, used_blocks, free_blocks from gv$sort_segment;
    INST_ID TABLESPACE_NAME TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS
    1 TEMP 638336 0 638336
    4 TEMP 565760 0 565760
    4 TEMP_SCHED 16776704 0 16776704
    3 TEMP 484864 0 484864
    3 TEMP_SCHED 0 0 0
    2 TEMP 455808 0 455808
    6 rows selected.
    SQL> SQL> SELECT S.sid || ',' || S.serial# sid_serial, S.username,
    2 T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace,
    3 T.sqladdr address, Q.hash_value, Q.sql_text
    FROM v$sort_usage T, gv$session S, gv$sqlarea Q, dba_tablespaces TBS
    4 5 WHERE T.session_addr = S.saddr
    6 AND T.sqladdr = Q.address (+)
    7 AND T.tablespace = TBS.tablespace_name
    8 ORDER BY S.sid;
    no rows selected

    Hello,
    You may try to catch the SQL with a Servererror Trigger.
    This link will give you an interesting example:
    http://oratips-ddf.blogspot.com/2008/09/to-err-is-human.html
    Hope this help.
    Best regards,
    Jean-Valentin

  • I have a php module which runs fine in Firefox and all other browsers but not Safari. It always run twice - I see a small ? in upper right corner which is causing it to run twice but NO idea why? Help - thank you

    I have a php module which runs fine in Firefox and all other browsers but not Safari. It always run twice - I see a small ? in upper right corner which is causing it to run twice but NO idea why? I read it MAY have something to do with am image it cannot load but I see them all loaded.  Help - thank you

    Could you share a link to the page?
    Seeing it in context and in our browsers is much easier to debug.
    If not, make sure to run the validator here The W3C Markup Validation Service and clear out any problems. HTML errors, especially structural ones, will cause all kinds of display problems in various browsers/versions/platforms.

  • How to identify what customer exit variables are used in which query?

    Hi all,
    When i happened to check the CMOD transaction code i can find a list of customer exits are used. But i want to know what are those customer exist are used in which query? can anyone let me know the procedure of identifying it.
    Thanks a lot
    Pooja

    hii pooja
    check the foll links
    Very Urgent: Customer Exit Variable
    customer exit variable
    MIssing Authorisation for customer exit variable query
    Authorization variable or customer exit variables
    if it is helpful assign points
    thanks.

  • How to make powermac G4 400GHz faster and run smoother.

    I really want to make my Power Mac G4 much faster and run smoother, can someone help me do this.
    P.S. I'm running mac OS X 10.4.11 and I'm trying to install mac OS X 10.6 snow leopard will upgrading my OS help improve performance.

    dragon,
    First thing to do, and the cheapest, is more RAM. It's not cool to recommend retailers, etc....but you really want to get the right stuff. Macs can be finicky about RAM. You can get the right stuff in many places...IF you know what you're doing. That being said, most 'pros' here in Discussions recommend macsales.com (OWC) and crucial.com because you'll get the right stuff at decent prices. Both have memory 'advisors', where you type in your machine type and get recommendations for the correct memory. Do that yourself, even if you're not ready to buy today.
    macsales.com has 512mb for about $30. Crucial wants $60; dunno why; they used to be comparable. One plan, on your limited budge, would be to get one 512mb stick; then save up and buy THE SAME product when you've saved up $30 more. I wouldn't mix. It can be done but you'll save yourself some grief just buying the same sticks from the same place. You'll see a pretty good improvement if you go to 1GB+.
    You'll also see pretty good performance if you limit the number of apps you install, particularly "third party plugins". Keep your Mac lean and mean and it'll perform well for years. Be sure to run Permissions Repair EVERY TIME you install an app. I say this because that 60GB HD will fill up pretty fast. Maybe it'd be better just to get the one 512MB stick, giving you 1.5GB RAM. Then, save up for a bigger HDD. You'll need those two upgrades before even thinking of a CPU upgrade.
    Get the free utility Macaroni and let it run daily, weekly, monthly tasks. Read thru other posts here in the 'Using ur PMac G4' and "Exanding ur PMac G4".
    Please come back if you have any more questions. HTH

Maybe you are looking for