Enhance a SQL query with update of millions of rows

Hi ,
I have this query developed to updated around 200 million of rows on my production , I did my best but please need your recommendations\concerns to make it more enhanced
DECLARE @ORIGINAL_ID AS BIGINT
SELECT FID001 INTO #Temp001_
FROM INBA004 WHERE RS_DATE>='1999-01-01'
AND RS_DATE<'2014-01-01' AND CLR_f1st='SSLM'
and FID001 >=12345671
WHILE (SELECT COUNT(*) FROM #Temp001_ ) <>0
BEGIN
SELECT TOP 1 @ORIGINAL_ID=FID001 FROM #Temp001_ ORDER BY FID001
PRINT CAST (@ORIGINAL_ID AS VARCHAR(100))+' STARTED'
SELECT DISTINCT FID001
INTO #OUT_FID001
FROM OUTTR009 WHERE TRANSACTION_ID IN (SELECT TRANSACTION_ID FROM
INTR00100 WHERE FID001 = @ORIGINAL_ID)
UPDATE A SET RCV_Date=B.TIME_STAMP
FROM OUTTR009 A INNER JOIN INTR00100 B
ON A.TRANSACTION_ID=B.TRANSACTION_ID
WHERE A.FID001 IN (SELECT FID001 FROM #OUT_FID001)
AND B.FID001=@ORIGINAL_ID
UPDATE A SET Sending_Date=B.TIME_STAMP
FROM INTR00100 A INNER JOIN OUTTR009 B
ON A.TRANSACTION_ID=B.TRANSACTION_ID
WHERE A.FID001=@ORIGINAL_ID
AND B.FID001 IN (SELECT FID001 FROM #OUT_FID001)
DELETE FROM #Temp001_ WHERE FID001=@ORIGINAL_ID
DROP TABLE #OUT_FID001
PRINT CAST (@ORIGINAL_ID AS VARCHAR(100))+' FINISHED'
END

DECLARE @x INT
SET @x = 1
WHILE @x < 44,000,000  -- Set appropriately
BEGIN
    UPDATE Table SET a = c+d where ID BETWEEN @x AND @x + 10000
    SET @x = @x + 10000
END
Make sure that ID column has a CI on.
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • SQL query with Bind variable with slower execution plan

    I have a 'normal' sql select-insert statement (not using bind variable) and it yields the following execution plan:-
    Execution Plan
    0 INSERT STATEMENT Optimizer=CHOOSE (Cost=7 Card=1 Bytes=148)
    1 0 HASH JOIN (Cost=7 Card=1 Bytes=148)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=4 Card=1 Bytes=100)
    3 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=3 Card=1)
    4 1 INDEX (FAST FULL SCAN) OF 'TABLEB_IDX_003' (NON-UNIQUE)
    (Cost=2 Card=135 Bytes=6480)
    Statistics
    0 recursive calls
    18 db block gets
    15558 consistent gets
    47 physical reads
    9896 redo size
    423 bytes sent via SQL*Net to client
    1095 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    55 rows processed
    I have the same query but instead running using bind variable (I test it with both oracle form and SQL*plus), it takes considerably longer with a different execution plan:-
    Execution Plan
    0 INSERT STATEMENT Optimizer=CHOOSE (Cost=407 Card=1 Bytes=148)
    1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=3 Card=1 Bytes=100)
    2 1 NESTED LOOPS (Cost=407 Card=1 Bytes=148)
    3 2 INDEX (FAST FULL SCAN) OF TABLEB_IDX_003' (NON-UNIQUE) (Cost=2 Card=135 Bytes=6480)
    4 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=2 Card=1)
    Statistics
    0 recursive calls
    12 db block gets
    3003199 consistent gets
    54 physical reads
    9448 redo size
    423 bytes sent via SQL*Net to client
    1258 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    55 rows processed
    TABLEA has around 3million record while TABLEB has 300 records. Is there anyway I can improve the speed of the sql query with bind variable? I have DBA Access to the database
    Regards
    Ivan

    Many thanks for your reply.
    I have run the statistic already for the both tableA and tableB as well all the indexes associated with both table (using dbms_stats, I am on 9i db ) but not the indexed columns.
    for table I use:-
    begin
    dbms_stats.gather_table_stats(ownname=> 'IVAN', tabname=> 'TABLEA', partname=> NULL);
    end;
    for index I use:-
    begin
    dbms_stats.gather_index_stats(ownname=> 'IVAN', indname=> 'TABLEB_IDX_003', partname=> NULL);
    end;
    Is it possible to show me a sample of how to collect statisc for INDEX columns stats?
    regards
    Ivan

  • SQL query with JSP and WML-parameters

    Hey,
    Could you help me?
    I'm trying to do the following. WML deck card 1 send parameter to same WML deck's card help. I try to read the parameter with JSP in card help by putting the parameter to SQL query, but it doesn't work. I can read the parameter with WML in card help. I can also print the value of the parameter with JSP if I generate WML with JSP.
    /*parameter sending from card 1 to card help*/
    out.println("<go href='#helpcard'>");
    out.println("<setvar name='valittukurssi' value='$(valittukurssi)'/>");
    /*parameter read with WML in card help */
    <p>Valitse kurssi.
    $valittukurssi</p>
    /'parameter read with JSP by generating WML with JSP*/
    out.println("<p>$valittukurssi</p>");
    /* SQL query with JSP */
    ResultSet uudettulokset = uusilause.executeQuery("select * from kurssi where lyhenne='$valittukurssi'");
    Thanks,
    Rampe

    You're problem is easy to fix. You're confusing WML variables with JSP variables. See below:
    >
    /*parameter sending from card 1 to card help*/
    out.println("<go href='#helpcard'>");
    out.println("<setvar name='valittukurssi'
    value='$(valittukurssi)'/>");
    Above you set a var that will work on the phone, not in JSP.
    /*parameter read with WML in card help */
    <p>Valitse kurssi.
    $valittukurssi</p>
    Yes the above does display the parameter, because it is a client side WML var, but you cannot use this variable in the JSP code (that's why your SWL fails).
    /'parameter read with JSP by generating WML with
    JSP*/
    out.println("<p>$valittukurssi</p>");Here's you're problem, the above line is EXACTLY the same as the one before it. When the container parses through this JSP code it translates the above line to:
    <p>$valittukurssi</p> on the WML page and the CLIENT uses it's local variable to display it.
    What you need and want is to have a variable that can be used in JSP code and output to your WML page. Here's how it's done:
    out.println("<go href='#helpcard'>");
    String some_name = "valittukurssi";
    out.println("<setvar name='"+some_name+"'
    value='$("+some_name+")'/>");
    //note that you may have to escape the ( and ) with a \
    //so we displayed the variable above into the WML page, now we can use it in the SQL query:
    /* SQL query with JSP */
    ResultSet uudettulokset =
    uusilause.executeQuery("select * from kurssi where
    lyhenne='"+some_name+"'");//the end of the command is: " ' " ) ;
    Frank Krul
    Got Node?

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • How could I replace hard coded value in my sql query with constant value?

    Hi all,
    Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
    PROCEDURE class_by_day_get_bin_data
         in_report_parameter_id   IN   NUMBER,
         in_site_id               IN   NUMBER,
         in_start_date_time       IN   TIMESTAMP,
         in_end_date_time         IN   TIMESTAMP,
         in_report_level_min      IN   NUMBER,
         in_report_level_max      IN   NUMBER
    IS
      bin_period_length   NUMBER(6,0); 
    BEGIN
      SELECT MAX(period_length)
         INTO bin_period_length
        FROM bin_data
         JOIN site_to_data_source_lane_v
           ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
         JOIN bin_types
           ON bin_types.bin_type = bin_data.bin_type 
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
       SELECT site_to_data_source_lane_v.site_id,
             site_to_data_source_lane_v.site_lane_id,
             site_to_data_source_lane_v.site_direction_id,
             site_to_data_source_lane_v.site_direction_name,
             bin_data_set.start_date_time,
             bin_data_set.end_date_time,
             bin_data_value.bin_id,
             bin_data_value.bin_value
        FROM bin_data
        JOIN bin_data_set
          ON bin_data.bin_serial = bin_data_set.bin_serial
        JOIN bin_data_value
          ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
        JOIN site_to_data_source_lane_v
             ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
            AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) lane_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'LANE'
                  AND report_parameters.report_parameter_name  = 'LANE'
             ) report_lanes
          ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) class_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'CLASS'
                  AND report_parameters.report_parameter_name  = 'CLASS'
             ) report_classes
          ON bin_data_value.bin_id = report_classes.class_id
        JOIN edr_rpt_tmp_inclusion_table
          ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data_set.start_date_time >= in_start_date_time
         AND bin_data_set.start_date_time <  in_end_date_time
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       =  bin_period_length;
    END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
    bin_data.bin_type            =  2But I dont want any hard coded number or string in the query.
    How could I replace it?
    I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
    bin_type     CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
    Thanks.
    Edited by: user10641405 on May 29, 2009 1:38 PM

    Declare the constant inside the procedure.
    PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
                                        in_site_id             IN NUMBER,
                                        in_start_date_time     IN TIMESTAMP,
                                        in_end_date_time       IN TIMESTAMP,
                                        in_report_level_min    IN NUMBER,
                                        in_report_level_max    IN NUMBER) IS
      bin_period_length NUMBER(6, 0);
      v_bin_type     CONSTANT NUMBER := 2;
    BEGIN
      SELECT MAX(period_length)
        INTO bin_period_length
        FROM bin_data
        JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                           site_to_data_source_lane_v.data_source_id
        JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time >=
             in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time <
             in_end_date_time + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type = v_bin_type
         AND bin_data.period_length <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
      INSERT INTO edr_class_by_day_bin_data
        (site_id,
         site_lane_id,
         site_direction_id,
         site_direction_name,
         bin_start_date_time,
         bin_end_date_time,
         bin_id,
         bin_value)
        SELECT site_to_data_source_lane_v.site_id,
               site_to_data_source_lane_v.site_lane_id,
               site_to_data_source_lane_v.site_direction_id,
               site_to_data_source_lane_v.site_direction_name,
               bin_data_set.start_date_time,
               bin_data_set.end_date_time,
               bin_data_value.bin_id,
               bin_data_value.bin_value
          FROM bin_data
          JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
          JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
                                 bin_data_value.bin_data_set_serial
          JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                             site_to_data_source_lane_v.data_source_id
                                         AND bin_data_set.lane =
                                             site_to_data_source_lane_v.data_source_lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'LANE'
                   AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
                                                                                         report_lanes.lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'CLASS'
                   AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
                                                                                            report_classes.class_id
          JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
                                              TRUNC(edr_rpt_tmp_inclusion_table.date_time)
         WHERE site_to_data_source_lane_v.site_id = in_site_id
           AND bin_data.start_date_time >=
               in_start_date_time - numtodsinterval(1, 'DAY')
           AND bin_data.start_date_time <
               in_end_date_time + numtodsinterval(1, 'DAY')
           AND bin_data_set.start_date_time >= in_start_date_time
           AND bin_data_set.start_date_time < in_end_date_time
           AND bin_data.bin_type = v_bin_type
           AND bin_data.period_length = bin_period_length;
    END class_by_day_get_bin_data;

  • How to write sql query with many parameter in ireport

    hai,
    i'm a new user in ireport.how to write sql query with many parameters in ireport's report query?i already know to create a parameter like(select * from payment where entity=$P{entity}.
    but i don't know to create query if more than 1 parameter.i also have parameter such as
    $P{entity},$P{id},$P{ic}.please help me for this.
    thanks

    You are in the wrong place. The ireport support forum may be found here
    http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=showcat&catid=9

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • Extract Sql Query with Actual Parameters from Report

    Hi
    I am able to extract query from Crystal Report using the following code :
    ReportDocument.ReportClientDocument.RowSetController.GetSqlStatement(new GroupPath, out tmp);
    But the sql query retrieve comes in the following format :
    select name , trans_code, account_code from command_query.accounts
    where account_code = {?Command_query_Prompt0}  and effective_date < '{?Command_query_prompt1 }'
    The parameters which I m using in the reports are :
    Account_Code and Effective_Date .
    Why does my extracted sql translates it into {?Command_query_Prompt0} and '{?Command_query_prompt1 }' .
    Is there any way to map this to the actual parameter values ?
    OR
    Can we extract the query after assigning the values ?
    Any help is appreciated ... 
    Thanks
    Sanchet

    hi,
    You can create nested sql query with conditional parameters,
    For example
    Select Code From OITT Where Code IN (Select ItemCode From OITM
    Where ItemName LIKE '[%0]' + '%%')
    Edited by: Jeyakanthan A on Jun 9, 2009 12:31 PM

  • Hosting company does not support SQL query with OUTFILE clause

    From my mysql database, I want to allow the user to run a query and produce a csv / text file of our membership database.   Unfortunately,  I just found out my hosting company does not support the SQL query with OUTFILE clause for MySQL database.
    Are there any other options available to produce a file besides me running the query in phpadmin and making the file available to users.
    Thanks.  George

    Maybe this external Export Mysql data to CSV - PHP tutorial will be of help
    Cheers,
    Günter

  • Update 65 millions of rows

    Hi!
    What's the best way to update 65 millions of rows? I don't have free space to create a new table.
    Thanks
    André

    declare v_records number;
    begin
    LOOP
       UPDATE table_name
       SET col_name = value
       WHERE condition
       AND ROWNUM <=10000;
       v_records := SQL%ROWCOUNT;
       IF v_records = 0 THEN
          EXIT;
       END IF;
    END LOOP;
    END;Cheers
    Sarma.

  • Write the sql query to find largest value in row wise without using   great

    write the sql query to find largest value in row wise without using
    greatest fuction?

    Another not so good way, considering you want greatest of 4 fields from a single record:
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (Select 100 col1,200 col2,300 col3,400 col4 from dual
      2  union select 500,600,700,800 from dual
      3  union select 900,1000,1100,1200 from dual
      4  union select 1300,1400,1500,1600 from dual
      5  union select 1700,1800,1900,2000 from dual
      6  union select 2100,2200,2300,2400 from dual
      7  union select 2800,2700,2600,2500 from dual
      8  union select 2900,3000,3100,3200 from dual)
      9  SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) Max_value
    10  FROM
    11  (SELECT (CASE WHEN col1_col2 > col2_col3 THEN col1_col2 ELSE col2_col3 END) col1,
    12         (CASE WHEN col2_col3 > col3_col4 THEN col2_col3 ELSE col3_col4 END) col2,
    13         (CASE WHEN col3_col4 > col4_col1 THEN col3_col4 ELSE col4_col1 END) col3
    14  FROM
    15  (SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) col1_col2,
    16         (CASE WHEN col2 > col3 THEN col2 ELSE col3 END) col2_col3,
    17         (CASE WHEN col3 > col4 THEN col3 ELSE col4 END) col3_col4,
    18         (CASE WHEN col4 > col1 THEN col4 ELSE col1 END) col4_col1
    19* FROM t))
    SQL> /
    MAX_VALUE
           400
           800
          1200
          1600
          2000
          2400
          2800
          3200
    8 rows selected.
    SQL> Edited by: AP on Sep 21, 2010 6:29 AM

  • SQL query with parameter returns empty result set, please help !!!

    Hi there,
    When I use the following query :
    <sql:query var="beroepsthemas" >
    select *
    from beroepsthemas
    where beroepsthemaid = ?
    <sql:param value="12"/>
    </sql:query>
    When I want to browse the result set with :
    <c:forEach items="${beroepsthemas.rows}" var="rij">
    it shows no records. But it must return at least one.
    All my jsp pages with sql queries and parameters have the same problem.
    This is all on my test environment. I'm using Ubuntu 5.10, Netbeans5.0, JDK 1.5_06, application runs in Bundeled Tomcat 5.5.9, MySQL 4.1.12, mysql-connector3.1.6
    When the same code is run on the live environment, it works just fine.
    The difference is :
    Mysql 4.1.10a, tomcat5.5.9, mysql-connector3.1.6
    What can there be wrong !!

    When the same code is run on the live environment, it
    works just fine.
    The difference is :
    Mysql 4.1.10a, tomcat5.5.9, mysql-connector3.1.6
    I didn't catch this. I think you may need to update the database driver.

  • Tuning SQL query with SDO and Contains?

    I'trying to optimize a query
    with a sdo_filter and an intermedia_contains
    on a 3.000.000 records table,
    the query look like this
    SELECT COUNT(*) FROM professionnel WHERE mdsys.sdo_filter(professionnel.coor_cart,mdsys.sdo_geometry(2003, null, null,mdsys.sdo_elem_info_array(1,1003,4),mdsys.sdo_ordinate_array(809990,2087279,778784,2087279,794387,2102882)),'querytype=window') = 'TRUE' AND professionnel.code_rubr ='12 3 30' AND CONTAINS(professionnel.Ctx,'PLOMBERIE within Nom and ( RUE within Adresse1 )',1)>0
    and it takes 15s on a bi 750 pentium III with
    1.5Go of memory running under 8.1.6 linux.
    What can i do to improve this query time?
    null

    Hi Vincent,
    We have patches for Oracle 8.1.6 Spatial
    on NT and Solaris.
    These patches include bug fixes and
    performance enhancements.
    We are in the process of making these patches
    avaialble in a permanent place, but until then, I will temporarily put the patches on:
    ftp://oracle-ftp.oracle.com/
    Log in as anonymous and use your email for
    password.
    The patches are in /tmp/outgoing in:
    NT816-000706.zip - NT patch
    libordsdo.tar - Solaris patch
    I recommend doing some analysis on
    individual pieces of the query.
    i.e. time the following:
    1)
    SELECT COUNT(*)
    FROM professionnel
    WHERE mdsys.sdo_filter(
    professionnel.coor_cart,
    mdsys.sdo_geometry(
    2003, null, null,
    mdsys.sdo_elem_info_array(1,1003,4),
    mdsys.sdo_ordinate_array(
    809990,2087279,
    778784,2087279,
    794387,2102882)),
    'querytype=window') = 'TRUE';
    2)
    SELECT COUNT(*)
    FROM professionnel
    WHERE CONTAINS(professionnel.Ctx,
    'PLOMBERIE within Nom and ( RUE within Adresse1)',1) >0;
    You might want to try reorganizing the entire
    query as follows (no promises).
    If you contact me directly, I can try to
    help to further tune the SQL.
    Hope this helps. Thanks.
    Dan
    select count(*)
    FROM
    (SELECT /*+ no_merge */ rowid
    FROM professionnel
    WHERE mdsys.sdo_filter(
    professionnel.coor_cart,
    mdsys.sdo_geometry(
    2003, null, null,
    mdsys.sdo_elem_info_array(1,1003,4),
    mdsys.sdo_ordinate_array(809990,2087279,
    778784,2087279,
    794387,2102882)),
    'querytype=window') = 'TRUE'
    ) a,
    (SELECT /*+ no_merge */ rowid
    FROM professionnel
    WHERE CONTAINS(professionnel.Ctx,
    'PLOMBERIE within Nom and
    ( RUE within Adresse1)',1) >0
    ) b
    where a.rowid = b.rowid
    and professionnel.code_rubr ='12 3 30';
    **NOTE** Try this with no index on code_rubr
    null

  • Sql query to update record?

    hi1
    i have 1000 rows in my table that are not unique. i have added a new column named sno.initially that contains null values. Now i want to update the table with sno contains serial no. from 1 to 1000 in a single SQL query
    please help
    Thanks
    Harinder

    hi1
    i have 1000 rows in my table that are not unique. i
    have added a new column named sno.initially that
    contains null values. Now i want to update the table
    with sno contains serial no. from 1 to 1000 in a
    single SQL query
    please help
    Thanks
    HarinderIt will work..
    Update <table_name> set <column_name> = ROWNUM
    whether the records are duplicate or not...

  • Form on SQL query for updating.

    Hello again,
    Im trying to wirte a form to udapte the information in a table. I have a table with a PK which holds a persons name, and an activity assigned to them (and loads of other fields but they dont matter atm). I would like to have a form which has an SQL query running in one region and then the form underneath to be able to edit (reassign a person to a different activity) an item appearing in the query result. Ive got a form at the moment which is form on an sql query but its not updating when i fill out the form, is it something to do with the regions?
    http://img.photobucket.com/albums/v611/Funky_Monk/untitled.jpg
    So on the screenie, i have the bottom region for the query (no values in table hence the error (i think!))
    The call ID is FK to another table
    severity level and status will be usdated here
    description is self-explanitory
    analyst_id is the main field to be changed here, the call id will be assigned a new analyst via this form.
    action_id is actions carried out on this problem.
    Any help would be greatly appreciated.
    DM

    hi,
    Can you put this example on apex.oracle.com?
    Regards,
    Kartik Patel
    http://patelkartik.blogspot.com/
    http://apex.oracle.com/pls/apex/f?p=9904351712:1

Maybe you are looking for

  • Cannot register workspace to shared services

    I am having a problem registering workspace with shared services during configuration. We are doing a new install of Hyperion 11.1.1.3 We were able to configure and deploy shared services successfully and log in. Any help would be greatly appreciated

  • Java.lang.UnsatisfiedLinkError: no ocijdbc8 in shared library path

    Hello i am getting this unsatisfied error whenever i use servlet & in my servlet i am using JDBC for connecting to Oracle. i need to know the solution for this please do let me know . Also do i need to know the JDBC re-alm set-up in Tomcat server. ja

  • Photo software for large collection

    Since upgrading to Yosemite I have experienced a few problem.  firstly 50% of my events lost their date and location details and i phone was very slow to load and close.  I took my i mac into the Apple store for their opinion, they could couldn't hel

  • Table height in Smart Forms

    Hi all I am using a table in smartforms main window and set its pattern as per the requirement.And i have given the minimum height of table as that of main window. If there is only one line item the height of the table is not growing to that of the m

  • Eclipse + terminal plugin ?

    Hi, I'm useing eclipse for programming microcontrollers, PIC from microchip. But I would like if there were any plugin or setting (have not found any so..) maybe plugin so that I could get an shell from inside. Just to typ in the command to the progr