Stuck in a loop

Post Reply
MiniMe
Posts: 210
Joined: Thu Mar 15, 2001 4:30 pm

Stuck in a loop

Post by MiniMe »

I have a vortex script that compares records in a temp table to records in a production table. It steps through each temp table row and searches the prod table for a matching key. If found it then compares the columns and updates the changed columns. The problem lies in that occassionally the search in the production table appears to get caught in a loop and one time I caught it searching for the same record for almost 7 hours. The table has the searched column indexed as shown below. Any ideas why it would get into this state?? When it has I have gone to the database with ltest and seen alternating I and i for the entire period until I kill the app.



Texis Version 03.01.971289085(20001011) Copyright (c) 1988-2000 Thunderstone EPI

NAME TBNAME FNAME COLLSEQ TYPE NON_UNIQUE FIELDS
------------+------------+------------+------------+------------+------------+------------+
xuseridrec books xuseridrec A B 01 USER_ID\USER_REC
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

Stuck in a loop

Post by Kai »

What is the exact SQL you're using for the outer SELECT loop from the temp table, any inner SELECTs, and any updates? Are there any indexes on the temp table?
MiniMe
Posts: 210
Joined: Thu Mar 15, 2001 4:30 pm

Stuck in a loop

Post by MiniMe »

There are no indexes on the temp table.. The ourtermost select statement is :

<sql ROW "delete from tempadds">

the next statement is:

<SQL MAX = '1' "select * from books where USER_ID\USER_REC= $ret"></sql>

and then it compares a found record to the temp one and does an update. If no record is found, it does an insert.
MiniMe
Posts: 210
Joined: Thu Mar 15, 2001 4:30 pm

Stuck in a loop

Post by MiniMe »

For instance.. Right now, it is stuck again.. this is what I see in ltest..

Texis Version 03.00.2406 Semaphore: 3843(1) Available Locks 499
Number of servers: 3 Database /db/tables/maint/SYSLOCKS

SERID PID
0 375788
1 487123 I
2 [ltest]







Table Name Table Name
SYSTABLES(9) SYSINDEX(9)
SYSUSERS(9) SYSPERMS(9)
SYSTRIG(9) SYSSTATISTICS(5)
books(11) I tempadds(4)
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

Stuck in a loop

Post by Kai »

Are there any other processes running which might update/insert/delete from either the temp or production table during this process (regardless of whether it's the affected row(s) or not)?

Try setting bubble=0 before this script starts, eg.:
<SQL "set bubble=0"></SQL>
This pre-loads index values before returning results, and may avoid this issue.
MiniMe
Posts: 210
Joined: Thu Mar 15, 2001 4:30 pm

Stuck in a loop

Post by MiniMe »

There are an occasional scripts that will delete from the prod table.. could these be causing this to happen??
MiniMe
Posts: 210
Joined: Thu Mar 15, 2001 4:30 pm

Stuck in a loop

Post by MiniMe »

Does <SQL "set bubble=0"></SQL> cover the whole script of just the next SQL call invoked??

thanks
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

Stuck in a loop

Post by Kai »

Covers the whole script; set it at startup.
MiniMe
Posts: 210
Joined: Thu Mar 15, 2001 4:30 pm

Stuck in a loop

Post by MiniMe »

Done.. I am running the script right now.. Ill let you know if it hangs..

Thanks again.
Post Reply