Problem with -rereadnolock param

Posted by oomsluc on 06-May-2009 03:41

Hi All
We have a problem with the –rereadnolock parameter .
When you run the program below with this param you get the double reads on the customer table 2000.
Is there an explanation on  this ?
When we add hquer#:cache = 1 this problem seems to be solved . Is there a global parameter to set this ?
Kind regards
DEF VAR i AS INT NO-UNDO INIT 0.
/* FOR EACH customer NO-LOCK,                                     */
/*   FIRST Order WHERE Order.custnum = Customer.custnum NO-LOCK:  */
/*   ASSIGN i = i + 1.                                            */
/*   IF i = 100 THEN LEAVE.                                       */
/* END.                                                           */
           
DEFINE VARIABLE wher#             AS CHAR       NO-UNDO.
DEFINE VARIABLE hquer#            AS HANDLE     NO-UNDO.
DEFINE VARIABLE hbCustomer        AS HANDLE     NO-UNDO.
DEFINE VARIABLE hbOrder           AS HANDLE     NO-UNDO.
ETIME(TRUE).
/* Traitement de la clause Frns */
CREATE BUFFER hbCustomer   FOR TABLE "Customer".
CREATE BUFFER hbOrder      FOR TABLE "Order".
CREATE QUERY hquer#.
ASSIGN wher# = "FOR EACH Customer NO-LOCK , FIRST Order WHERE Order.CustNum = Customer.CustNum NO-LOCK"
       .
hquer#:SET-BUFFERS(hbCustomer,hbOrder).
 
IF hquer#:QUERY-PREPARE(wher#)
THEN DO:
    hquer#:QUERY-OPEN().     
    hquer#:GET-FIRST().
 
    DO WHILE /*NOT hquer#:QUERY-OFF-END*/ hbCustomer:AVAILABLE :
     
      ASSIGN i = i + 1.
      IF i = 1000 THEN LEAVE.
        hquer#:GET-NEXT().
    END.
 
    hquer#:QUERY-CLOSE().
END.
DELETE OBJECT hquer#.
DELETE OBJECT hbCustomer.
DELETE OBJECT hbOrder.
        MESSAGE ETIME
          VIEW-AS ALERT-BOX.
RETURN "ok".

All Replies

Posted by davidkerkhofs3 on 07-May-2009 07:00

Hi Luc,

I've simulated your case and I was able to reproduce it, in 10.1B.

What I noticed:

FOR EACH statement with a join: normal number of reads in VST

Static query with a join: normal number of reads in VST

Dynamic query with a join: the number of reads for the second table in the join is doubled in VST, this number is also the difference between the number of reads in VST for the first table and what the actual figure should be

Without -rereadnolock all three queries give the same result in VST.

Perhaps good to know, the number of index reads for the data is the same for all three queries, with or without the -rereadnolock client parameter.

Strange case...

David

This thread is closed